Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Trouble with transform-origin in animation

Let's see if I can explain this.

I am trying to get an element to rotate 75deg along the x axis, then move upward along the z-axis, and then do a full rotation around the x axis. However, it looks like the transform-origin does not follow the element when it is moved along the z axis, so the full rotation is animated along the starting origin. I have tried moving the origin within the animation using "transform-origin: 50% 50% 100px;" but that ends up moving the element along with the origin. Here's a link to it: http://codepen.io/anon/pen/pCDuz. I have run out of ideas so any help would be appreciated. Thanks!

1 Answer

Well, I figured it out. Had to put the element inside another div and use two separate keyframe animations. (http://codepen.io/joshalling/pen/LguDe) Thanks to anyone who tried to help.