Menu

How I made a phone animation go from ~35 fps to ~140 fps: draw once, then only move it
📰

How I made a phone animation go from ~35 fps to ~140 fps: draw once, then only move it

DEV Community: css·Dmytro Zeleniuk·about 2 hours ago
#UqvEqr5r
#devtocss#devto#dev#towel#phone
Reading 0:00
15s threshold

I build InviteMeOut, an app for invitations and small-business pages that open with an animation: a wax seal that breaks, curtains that part, a towel that wipes dust off a car. The opening is the first thing a guest sees, so it has to be smooth on a three-year-old phone, not just on my laptop.

One of them wasn't. Here's what was wrong and the rules I follow now.

The slow version

The opening for a car-detailing business page wipes a layer of dust off the screen with a towel. The first version did it the "obvious" way:

a full-screen SVG mask that grew as the towel moved,

feGaussianBlur and feTurbulence filters for soft, dusty edges,

the towel itself as a filtered SVG, animated with SMIL,

a scale on the whole layer, and a backdrop-filter: blur() pill floating on top.

In Chrome's phone emulation it ran at about 35 fps. On a real phone it was worse.…

Continue reading — create a free account

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