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 CSS Transitions and Transforms Adding 3D Effects with CSS Build a Rotating 3D Cube

Sasha Drmic
Sasha Drmic
12,316 Points

rotateY values

Can someone explain me why did we use those values for RotateY? For example:

  • I expected that the back side should be rotated for NEGATIVE 270degs, because the whole cube rotates clockwise (-270degs)

  • I expected the left side to rotated for -90degs

I'm very confused by these values.

2 Answers

Camilo Luna
Camilo Luna
8,836 Points

Since the .left side is the second image you see, you need it to start "looking" to the right so when it is visibile, you see its front.

Since you are using negative values rotateY(-270deg) the images are rotating to the left 3/4 of a turn. If you rotate -90deg (1/4 to the left) the image will start "looking" at the left and when it is visible (after rotating 1/4 to the left) you would have a flipped image since (-90deg) + (-90deg) = 180deg.

To check that this is happening indeed, exchange properties between .left and .back to see it with the text "side".

Cindy Lea
PLUS
Cindy Lea
Courses Plus Student 6,497 Points

Clockwise is turning to the left so the values go toward a positive direction.