Fix animations that run twice as fast on phones with a faster screen
A slide, a fade or a falling piece takes the right time on your phone but races on a newer one, or crawls on an old one. The cause is counting frames instead of time. This entry shows how to make the AI move things by elapsed time so every screen looks the same.
Why this works
Screens redraw at different rates, but a second is a second on every one. If motion depends on how many pictures were drawn, it differs between devices. Tie it to elapsed time, and splitting a moment into more or fewer frames gives the same result.
When not to use it
Not every animation wants this. A hand-drawn flipbook, where each picture is a fixed pose, should step through frames at its own beat. Also, a smooth chase never quite arrives, so finish it with a stop once it is close enough.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- A diagram of every state
- 15 lines of example code with 5 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Fix animations that run twice as fast on phones with a faster screen" (read_entry animation-speed-differs-on-fast-phones) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP