{"id":336563,"date":"2021-03-23T07:56:10","date_gmt":"2021-03-23T14:56:10","guid":{"rendered":"https:\/\/css-tricks.com\/?p=336563"},"modified":"2021-03-23T07:56:12","modified_gmt":"2021-03-23T14:56:12","slug":"image-fragmentation-effect-with-css-masks-and-custom-properties","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/image-fragmentation-effect-with-css-masks-and-custom-properties\/","title":{"rendered":"Image Fragmentation Effect With CSS Masks and Custom Properties"},"content":{"rendered":"\n

Geoff shared this idea of a checkerboard where the tiles disappear<\/a> one-by-one to reveal an image. In it, an element has a background image, then a CSS Grid layout holds the \u201ctiles\u201d that go from a filled background color to transparent, revealing the image. A light touch of SCSS staggers the animation.<\/p>\n\n\n\n

I have a similar idea, but with a different approach. Instead of revealing the image, let\u2019s start with it fully revealed, then let it disappear one tile at a time, as if it\u2019s floating away in tiny fragments.<\/p>\n\n\n\n\n\n\n\n

Here\u2019s a working demo of the result. No JavaScript handling, no SVG trickery. Only a single <img><\/code> and some SCSS magic.<\/p>\n\n\n\n