~/guides/SPRITE.md

Guides / Build apps

A waving mascot from one ChatGPT image: a 6-frame sprite sheet, a looping GIF, and Claude Code puts it on your page

No motion designer needed: ChatGPT makes 6 frames in one image, Claude Code cuts, aligns and loops them into a GIF and a CSS sprite, then adds it to your page.

A mascot that waves on your homepage or a product that spins at the top of your newsletter used to be a small motion-design job. Now one image does it: ask ChatGPT for 6 frames in the same image, same character, light and background, only the pose changing; then have Claude Code cut it apart, loop it into a GIF and put it on your page. This is the full version of the SPRITE reel: the prompt I actually used (swap the [] parts), the two instructions for Claude Code, and what to watch for in emails. The coffee-cup mascot, the 6 cut frames, the GIF and the demo page in the video were all really made on 10 November 2026.

01The result: one image becomes a waving mascot on your homepage

An orange coffee-cup mascot waving in a loop, made from 6 frames
The real loop: ChatGPT's 6 frames, cut apart, aligned and played in order.

There are only three steps: ChatGPT makes one image with 6 frames, Claude Code cuts it into a GIF (or a CSS sprite), and it goes into your page. Every step below has text you can copy.

A demo landing page called 小抄週報 with the waving coffee-cup mascot on the right and a small one in the sign-up strip
My demo page (the newsletter is fictional): the GIF on the right, the small one below is the CSS sprite.
  1. The ChatGPT prompt that gets 6 frames of the same character in one go.
  2. The instruction for Claude Code: cut, align, loop into a GIF and a CSS sprite.
  3. The code for your homepage or newsletter (one img for the GIF, a few lines of CSS for the sprite).
  4. What to watch for: emails, file size, and results that change every time.

02Step 1: ask ChatGPT for all 6 frames in the same image

A 3x2 grid generated by ChatGPT: the same orange coffee-cup character in all 6 cells, only the right arm changes
What ChatGPT actually made (one generation): a 3x2 grid of 6 frames, only the right arm moves.

The key is generating all 6 frames at once in one image. Generate them separately and the size, colour and lines often drift from frame to frame, so the loop jumps. In one image, all 6 are the same character.

Reel frame: six coffee cups in different colours under a red stamp saying they all look different
Reel frame (illustration): separate generations often drift. These 6 are one real frame with colour filters.
ChatGPT image prompt (the exact one I used; swap the [] parts for your character and moves)
Create one image: a 3x2 grid of 6 equal square frames of the SAME character, for a looping [waving] animation (sprite sheet). Character: [a cheerful round orange coffee-cup mascot with small stubby arms, a tiny steam curl on top and a simple happy face], [flat 2D illustration with a clean dark outline]. Every frame must be identical except the pose: same character size and position, same soft light, same plain [cream] background ([#F5EEDF]), no text, no frame numbers, thin even gaps between frames. Only [the right arm] moves: frame 1 [arm down], frame 2 [arm rising], frame 3 [arm up], frame 4 [hand tilted left (wave)], frame 5 [hand tilted right (wave)], frame 6 [arm coming back down]. Frames read left to right, top row then bottom row. Wide 3:2 image.
  1. Open a new ChatGPT chat and paste the prompt.
  2. Swap the [] parts for your character, style, background colour and the 6 poses. Poses that go out and come back work best: frame 6 leads back into frame 1, so the loop is smooth.
  3. Check the result: are all 6 frames the same size and position? Are there thin white gaps between them? If one frame is off, regenerate the whole image instead of fixing one cell.
  4. For a spinning product: make each frame turn 60 degrees, so 6 frames make one full turn.

03Step 2: have Claude Code cut, align and loop it into a GIF and a sprite

Folder view: grid.png cut into frame-1 to frame-6, then made into mascot.gif and sprite.png
The files it really made: grid.png → 6 frames → mascot.gif (426 KB) and sprite.png.

Save the image as grid.png in your project folder, open Claude Code there and paste this:

For Claude Code (swap the [] parts for your file name and settings)
This [grid.png] is a 3x2 sprite sheet from ChatGPT: 6 frames of the same character. Write a Python script that:
1. Finds the white gaps between the cells and cuts along them into frame-1.png to frame-6.png (left to right, top row then bottom row).
2. Lines the 6 frames up on the part that doesn't move ([the left half: handle, face, feet]), then crops them to the same size.
3. Uses ffmpeg to turn the 6 frames into a [6] fps mascot.gif that loops forever (palettegen / paletteuse so the colours stay right).
4. Also writes one horizontal sprite.png (the 6 frames side by side) for a CSS animation.
Tell me the result of each step and the file sizes.
  1. Cut along the white gaps, not into equal thirds: ChatGPT's cells aren't always exactly the same width. My first try found the gaps by average brightness and cut through the cups; looking for near-white lines fixed it.
  2. Aligning matters: our character moved 2 to 4 pixels between frames, and without aligning the GIF shakes.
  3. Speed: 6 fps is about 0.17 s a frame, right for a wave; use 4 or 5 for slower.
The ffmpeg command I actually used (6 frames → looping GIF)
ffmpeg -framerate 6 -i frames/frame-%d.png -vf "scale=360:-1:flags=lanczos,split[a][b];[a]palettegen=stats_mode=full[p];[b][p]paletteuse=dither=sierra2_4a" -loop 0 mascot.gif

04Step 3: put it on your homepage or in your newsletter

Code view: one img line for the GIF and a few lines of CSS playing sprite.png with steps(6)
The code the demo page really uses.
For Claude Code (swap the [] parts for your page and position)
Put mascot.gif into [index.html] on [the right side of the homepage hero], [400px] wide.
Then use sprite.png to add a [96px] mascot to [the newsletter sign-up block]: a CSS background with an infinite steps(6) animation, 6 frames per second.
It must work on phones too. Show me which lines you changed.

The result will look roughly like this. The GIF is one img; the CSS sprite puts the 6 frames side by side in one strip and jumps frame by frame with steps(6):

GIF and CSS sprite code (copy as is)
<!-- GIF: just one img -->
<img src="mascot.gif" alt="waving mascot" width="400">

<!-- CSS sprite: one sprite.png (6 frames side by side) -->
<div class="sprite"></div>

.sprite {
  width: 96px; height: 96px;
  background: url(sprite.png) 0 0 / 600% 100% no-repeat;
  animation: wave 1s steps(6) infinite;
}
@keyframes wave { to { background-position: 120% 0; } }
  1. On a web page either works: the GIF is simplest; the CSS sprite lets you control speed and pause with CSS.
  2. In a newsletter, use the GIF: most email clients don't support CSS animation.
  3. background-size 600% is because there are 6 frames; animating the position to 120% with steps(6) lands exactly on 0%, 20% … 100%, one per frame.

05Good to know

Reel frame: in an email window the cup stops on frame 1, labelled as showing frame 1 only, with a green stamp
Reel frame (illustration, not Outlook's interface): when only frame 1 shows, frame 1 has to work on its own.
  1. Some Outlook shows only the first frame of a GIF. Microsoft says only the first frame appears when animated GIFs are turned off, and email testing sites report older desktop Outlook plays only frame 1. So make frame 1 a complete, good-looking picture.
  2. ChatGPT gives a different result every time. If the cells don't line up or the character changes in one frame, regenerate the whole image.
  3. File size: our GIF is 360 px wide and 426 KB. Big GIFs load slowly in emails; make it smaller if needed.
  4. The six differently coloured cups in the reel are an illustration; the coffee cup, the 6 frames, the GIF and the demo page are the real output.

Sources

Related guides