It all started a few months ago, when Chris Coyier casually asked me how would I move an element along a circle, without of course rotating the element itself. If I recall correctly, his solution was to use multiple keyframes, for various points on a circle’s circumference, approximating it. I couldn’t think of anything better at the time, but the question was stuck in the back of my head.
3 months ago, I came up with a first solution. Unfortunately, it required an extra wrapper element. The idea was to use two rotate transforms with different origins and opposite angles that cancel each other at any given time. The first transform-origin would be the center of the circle path and the other one the center of the element. Because we can’t use multiple transform-origins, a wrapper element was needed.
So, even though this solution was better, I wasn’t fully satisfied with it due to the need for the extra element. So, it kept being stuck in the back of my head.
Recently, I suggested to www-style that transform-origin should be a list and accept multiple origins and presented this example as a use case. And then Aryeh Gregor came up with this genius idea to prove that it’s already possible if you chain translate() transforms between the opposite rotates.
I simplified the code a bit, and here it is:
With the tools we currently have, I don’t think it gets any simpler than that.
Pingback: Rotating CSS elements – have some fun with CSS! | Oirs World()
Pingback: Web Design Weekly #30 | Web Design Weekly()
Pingback: La veille du week-end (vingt-quatrième) | LoïcG()
Pingback: 5 Use Cases for Icon Fonts | Web Development, Search Engine Optimization, Social Media Marketing Guru()
Pingback: 5 Use Cases for Icon Fonts | Lunarium Design()
Pingback: 5 Use Cases for Icon Fonts()
Pingback: 5 Use Cases for Icon Fonts | CSS-Tricks | Free Tattoo Font Generator Software For Unique Personalized Tattoo Designs()
Pingback: 5 Use Cases for Icon Fonts « My Portfolio Design()
Pingback: Moving an element along a circle | OTIS Web Workshop()
Pingback: Amazing CSS Demos | TechSlides()
Pingback: CSS Animation Tricks: State Jumping, Negative Delays, Animating Origin, and More | Beta Sites Galore()
Pingback: CSS Animation Tricks: State Jumping, Negative Delays, Animating Origin, and More | WarWebDev()
Pingback: CSS Animation Tricks: State Jumping, Negative Delays, Animating Origin, and More - Abstract PHP()
Pingback: Трюки с CSS-анимациями: мгновенные изменения, отрицательные задержки, анимация transform-origin и другое » ALeXVoz Blog()
Pingback: Трюки с CSS-анимациями: мгновенные изменения, отрицательные задержки, анимация transform-origin и другое | Вёрстка, интернет, SEO, WordPress, CSS, HTML5, маркети()
Pingback: 纯CSS实现圆周运动 + (针对IE的降级处理) | Fengshuo's Blog()
Pingback: Even More Interesting URL’s | Devorous()
Pingback: Трюки с CSS-анимациями: мгновенные изменения, отрицательные задержки, анимация transform-origin и другое | Блог web-разработчика()
Pingback: CSS Animation Tricks: State Jumping, Negative Delays, Animating Origin, and More | AsterHost()
Pingback: Trucchi sulle animazioni CSS | Laboratorio CSS()
Pingback: Wavy Gravy | Cataloupe()
Pingback: HTML5 Weekly No.25 | ENUE Blog()
Pingback: Smokie Does Stuff()