Australian Technology

Make anything barrel roll

Takeaway: If you type “do a barrel roll” into Google, the page rotates. That’s nice but with this one-liner we can do it on any site we wish.

The online universe is falling all over itself this morning with news that Google can rotate a page.

While that’s nice, let’s do it to any page we want. After you load a page, copy and paste the following code into the address bar:

javascript:function rotateit(x){x = parseInt(x);document.body.setAttribute('style', ' -moz-transform: rotate('+x+'deg); -moz-transform-origin: 50% 50%; -webkit-transform: rotate('+x+'deg); -webkit-transform-origin: 50% 50%; -o-transform: rotate('+x+'deg); -o-transform-origin:50% 50%; -ms-transform: rotate('+x+'deg); -ms-transform-origin: 50% 50%; transform: rotate('+x+'deg); transform-origin: 50% 50%;');}for(i=0;i<=360;i++){setTimeout("rotateit("+i+")",i*40);}void(0);

There we go, any page can be rotated (tested in Chrome at this point) and you can amuse your friends for a few seconds.

It turns out that since Firefox 6, pasting javascript into the address bar is not allowed — but we can get around this by creating a bookmark that does it for us.

Simply copy the code example above and paste it into the location field of a new bookmark. Add it to your bookmark bar and now you have a button that will rotate anything you like.

After testing this on Safari, it looks like Safari users are out of luck.

Get IT Tips, news, and reviews delivered directly to your inbox by subscribing to TechRepublic’s free newsletters.

Chris Duckett

About Chris Duckett

Programmer and journalist Chris Duckett is the Editor for TechRepublic Australia.

Chris Duckett

Chris Duckett
Chris started his journalistic adventure in 2006 as the Editor of Builder AU after originally joining the company as a programmer. He left CBS Interactive in 2010 to follow his deep desire to study the snowdrifts and culinary delights of Canada and returned to CBS in 2011 as the Editor of TechRepublic Australia, determined to meld together his programming and journalistic tendencies once and for all.
11
Comments

Join the conversation!

Follow via:
RSS
Email Alert