Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

rotateZ() | CSS-Tricks

CSS-Tricks·Gabriel Shoyombo·19 days ago
#jiK7cBw9
Reading 0:00
15s threshold

The CSS  rotateZ()  function rotates an element around its z-axis, so clockwise or counterclockwise. While it produces the same visual effect as the  rotate()  function, it’s best used in 3D transformations. It is one of many transform functions used along with the  transform  property. In the demo, we first set up a stage for our 3D element with  perspective . It represents the projection of the 3D element from the viewer’s perspective, indicating how far or close the object appears. .stage { perspective: 800px; } We then simulate the tumbling effect of a coin that is spun on a table in slow motion, so we use three 3D rotation transform functions:  rotateX() ,  rotateY() , and  rotateZ() . The rotate()  shorthand cannot be used here because it maps to a 2D matrix and could lead to wrong calculations in the browser’s matrix math when combined with 3D functions.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More