Make a moving-dots explainer video with Claude
This is how the reel on how AI chatbots work was made. There was no video editor and no AI video model. Claude wrote one web page that moves 2,160 dots, and a small script that records it. The prompt below sets that up for any topic you want to teach.
How to use it
- Install Claude Code and ffmpeg, then open Claude Code in an empty folder. It will install the browser tool (Playwright) itself when it needs it.
- Copy the prompt, fill in the two lines in square brackets, and paste it in.
- Read the plan it shows you. The shapes are the whole video, so swap any shape that does not show its step before it writes code.
- For the voice, record the narration lines with any text-to-speech tool (I used ElevenLabs) and give Claude the audio file. It lines the picture up with the words.
- When it shows you the contact sheet, point at what looks wrong in plain words. My notes after the first draft were: bigger dots, no gaps in the grids, and spell the names with the dots.
The prompt
Make a short explainer video where one cloud of dots stays on screen the whole time and re-forms for every step. Entirely in code. No video editor and no AI video model. Topic: [WHAT YOU WANT TO EXPLAIN, for example "how AI chatbots work"] Steps: [5 TO 10 STEPS, ONE SHORT SENTENCE EACH] How to build it: 1. Plan first, and show me the plan before you write any code: one narration line per step (15 to 20 words), and for each step the shape the dots take to show it. Good shapes: a block that splits into pieces, columns, arcs between points, a bar chart, a ring, a spiral, a word spelled in dots. Wait for my OK. 2. Write one HTML page with a 1080x1920 canvas. A single function draw(t) paints the whole frame for the time t in seconds. No CSS animations, no timers, no randomness without a fixed seed. Expose it as window.__seek(t). 3. Create about 2,000 dots once. Each dot keeps its number, a colour group and three fixed random values for the whole video. Pick a dot count that divides evenly into your grids (2,160 works), so no grid ends in a half-filled row. 4. Write each step as a function that takes a dot and the time and returns where that dot is. The dots keep moving inside every shape: rows that scroll, dots that orbit, a wave that passes through. Nothing sits still. 5. Between steps, fly every dot from its old place to its new one in about one second. Start each dot at a slightly different moment, ease in and out, bend the path a little, and draw a short streak behind a dot while it moves. 6. To spell a word with the dots, draw the word on a hidden canvas, walk along each row of pixels, and put evenly spaced dots in every run of ink. Dots left over share a place with another dot. 7. Above the dots show a step counter, a big title and one short line with one highlighted word. Keep everything that matters inside x 150 to 930 and y 210 to 1560, so the Instagram interface does not cover it. 8. Timing: if I give you a narration file, use Whisper to get the time of every word, start each step 0.4 seconds before its line, and trigger changes inside a step on the word that names them. With no narration, give each step 5 seconds. 9. Make the last half second fly the dots back into the first shape, so the video loops. 10. Write a render script: open the page in headless Chromium with Playwright at 1080x1920, call window.__seek(frame / 60) for every frame, save each frame, then encode with ffmpeg as H.264, 60 fps, yuv420p. Before the full render, save a contact sheet with one still per step, look at it yourself, fix anything that overlaps or is hard to read, and show me the sheet. Style: a dark navy background with a faint grid, six dot colours, dots about 9 px wide.
Why it is written this way
- The same dots, all the way through. Each dot keeps its identity, so your eye follows the cloud from one idea into the next. There is never a cut to look away on.
- Every shape keeps moving. A grid that only sits there reads as a slide. Rows that scroll and dots that orbit keep the picture alive while the voice explains it.
- The voice sets the clock. Each step lasts exactly as long as its sentence, and a change inside a step lands on the word that names it. You never have to line anything up by hand.
What the reel shows
- Tokens. Your message is cut into small pieces called tokens. A token is a word or a part of one. "The cat sat on the mat" is 6 tokens.
- Embeddings. Each token is turned into a long list of numbers. Tokens with similar meanings get similar lists, so they sit close together.
- Attention. Every token looks at the other tokens and takes more from the ones that matter to it. In the example, "sat" looks hardest at "cat".
- Layers. That step is repeated through dozens of layers. Each pass sharpens what every token means in this sentence.
- Prediction. At the end the model gives a score to every token it knows, for how well it would fit next.
- Sampling. It picks one token. Usually a likely one, sometimes a less likely one, which is why the same question can get different answers.
- The loop. It adds the picked token to the text and runs everything again. That is why an answer appears word by word.
- Training. The model learned this by guessing the next word in huge amounts of text, and adjusting billions of numbers after each miss.
- Fine-tuning. Then it was trained again on conversations, so that it answers like a helpful assistant.
- Same recipe. ChatGPT, Claude and Gemini are all built this way. They differ in their data, their size and their training.
The example sentence, the scores on the bars and the 48 layers are made up to show the idea. They are not measurements of any model.
What to expect
The first draft is rarely the final one. Plan on two or three rounds of notes. Dots are good at grids, charts, rings, flows and short words, and poor at detailed pictures, so pick shapes a few thousand dots can draw.