Originally published at grzegorzotto.dev . Translated from Polish with AI; the Polish original is my own writing.
A page effect does not have to cost you SEO or accessibility: move the real elements with a transform instead of painting a screenshot of them.
On grzegorzotto.dev , on the home page / and on the /projects page, there is a Collapse button (on a phone, an icon in the top bar). Click it and the page collapses: headings, cards and the table fall, collide and pile up at the bottom of the screen. None of it is an image. These are the same DOM nodes that were there before the click, only moved and rotated by CSS transform .
This post is about why I built it this way, what broke on the way, and what I built and then threw away.
Why a transform and not a screenshot into a canvas
The obvious alternative is to take a snapshot of the page into a canvas and "smash" the picture. It looks the same and avoids the trouble of a real page layout.…