← Pixel Art from Scratch
Lesson 59 of 61 · 5 XP
Smooth animation and the GIF format
Theory
Machine translation, not yet reviewed by a native speaker.
In 16-bit games there are more frames, and animation tricks appear:
- smear — in the fastest frame the weapon is drawn as a stretched trail: the eye sees the speed;
- squash and stretch — the body crouches before a jump and stretches in flight;
- hold — on the impact frame the pause is longer (100–200 ms): the strike "is felt";
- looping — the last frame must flow smoothly into the first.
GIF is an old animation format that opens everywhere. Under the hood:
- a shared palette of up to 256 colours (more than enough for pixel art);
- "yes/no" transparency — there are no semi-transparent pixels;
- each frame has a delay in hundredths of a second — that's why 30 ms becomes 3 hundredths;
- the pixels are compressed with LZW: repeating sequences are replaced with dictionary codes — for pixel art with big single-colour areas this is very efficient.
The GIF button in the export builds the file right in the browser (our encoder is 150 lines of JavaScript). For a game engine, a PNG sprite sheet is better: all the frames in a row.