How to Create the 360° "Do a Barrel Roll" Effect in CSS3, JavaScript & WAAPI
Interactive CSS3 Barrel Roll Code Generator
1. Why transform-origin: 50% 50vh Prevents Scrollbar Chaos
If you apply transform: rotate(360deg) directly to a tall 3,000-pixel <body> element without setting the transform origin, the browser pivots the page around its vertical midpoint (1,500px down the page)—flinging the visible header completely off-screen! Setting transform-origin: 50% 50vh locks the pivot point to the exact center of the user's current viewport window, while overflow-x: hidden prevents horizontal scrollbar flashing during the 45° and 135° diagonal peaks.
2. One-Line JavaScript Bookmarklet ("Barrel Roll Any Website")
Paste the following one-liner into your browser console or save it as a bookmark URL to make any website perform a smooth 4-second 360° barrel roll: