Rara turns a two-sided cloth while Wulan photographs it: set perspective, transform, backface-visibility and transform-style, then the corners the browser…
Why it matters
Flip cards, 3D carousels, tilt-on-hover: all use this pattern. Almost every bug is one of three: no perspective on the container (flat), no backface-visibility (the back shows through), or an overflow: hidden that quietly flattens preserve-3d.
The key idea
perspective is the camera distance: the smaller, the stronger
Common mistakes
rotateY looks flat, not 3D No perspective on the container (the parent). Without it the projection is straight on, so a turn only shows as narrowing. Or write transform: perspective(800px) rotateY(…) on the element itself, with perspective() first.
A 3D effect suddenly goes flatoverflow other than visible on the same element as preserve-3d makes the browser use it as flat (so do opacity below 1, filter, clip-path), though getComputedStyle still says preserve-3d. Move that effect to another element, like each face.
The back face shows through Two faces on one plane are drawn in HTML order, so the later one covers the earlier. Add backface-visibility: hidden to each face, and turn the back face rotateY(180deg) first.
Try it in this playground
Slide the camera distance to 250, then 1500 Watch the numbers on the cloth’s left and right sides: a close camera makes a big difference, a far one is nearly flat.
Pick "No perspective"rotateY still works, but the near and far sides are the same height: it only narrows, no depth.
Turn the cloth over Slide rotateY past 90°. The cloth faces away from the camera, and the back (turned 180° beforehand) now faces it.
Put overflow: hidden on the cloth The probe says 3D is no longer kept, though getComputedStyle still says preserve-3d. Turn the cloth over: a mirrored front shows.