{"id":243778,"date":"2016-07-22T14:42:07","date_gmt":"2016-07-22T21:42:07","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=243778"},"modified":"2019-05-29T20:00:22","modified_gmt":"2019-05-30T03:00:22","slug":"offset-rotate","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/o\/offset-rotate\/","title":{"rendered":"offset-rotate"},"content":{"rendered":"
This property began life as The Imagine the element being animated along a path is a little race car. As the race car moves along the path, it really needs to rotate so that the front of the car is facing in the direction it’s moving, otherwise, it will look weird and unnatural. Thankfully, the default value for See this demo:<\/p>\n \n See the Pen The This browser support data is from Caniuse<\/a>, which has more detail. A number indicates that browser supports the feature at that version and up.<\/p><\/div>motion-rotation<\/code>, then it became
offset-rotation<\/code>, now it’s
offset-rotate<\/code>. It’s still a Working Draft experimental property so 🤷♀️. If you’re going to use it, you might as well use whatever the most recent thing is.<\/p>\n
offset-rotate<\/code> property in CSS controls the angle of an element depending on its
offset-distance<\/code><\/a> along a
offset-path<\/code><\/a>.<\/p>\n
offset-path<\/code> is
auto<\/code> which does exactly that. <\/p>\n
\n scalextric car on motion-path<\/a> by Chris Coyier (@chriscoyier<\/a>)
\n on CodePen<\/a>.<\/span>\n<\/p>\nPossible Values<\/h3>\n
.mover {\r\n offset-rotate: auto; \/* default, faces forward *\/\r\n offset-rotate: reverse; \/* faces backward *\/\r\n offset-rotate: 30deg; \/* fixed angle *\/\r\n offset-rotate: auto 30deg; \/* combine auto behavior with a set rotation *\/\r\n}<\/code><\/pre>\n
Browser support<\/h3>\n
offset-*<\/code> properties are still considered an experimental feature at the time of this writing. If the current lack of browser support makes you hesitant to use it on a project, then you might want to consider using GSAP<\/a> for this level of animation. This will offer you the widest browser support at the moment.<\/p>\n
Desktop<\/h4>