Library
Loading / Phone
Battery Charge
A glass battery fills cell by cell, its bolt lights up, then it flashes full and drains.
- Loop
- 8 s, seamless
- Video
- 1080p, 30 fps, no sound
- Built with
- HTML canvas, one file
- Made with
- Claude Sonnet 5.5, max effort
The prompt
The prompt this loop was built from. Paste it into your agent to make your own version from the idea.
Make a seamless 8 second motion loop of a battery charging. On a warm light ground with two large blurred color glows drifting slowly behind it, a tall glass battery with a small terminal nub on top stands in the middle: a rounded outline with a soft inner shadow, five empty cells stacked inside it and a faint lightning bolt in the center. The cells fill from the bottom one after another with a glossy liquid that shades from the second accent at the bottom to the first accent at the top, with a bright line at its surface and small energy dots drifting upward inside it. The bolt turns white where the liquid has reached it and pulses while charging. When the battery is full the bolt flashes, an outline ring spreads out, sparkles pop from the top, the nub takes the first accent color and a soft glow breathes around the body. It holds full for a moment, then the cells drain from the top down and the battery rests empty before the loop repeats. The battery is drawn a little larger when the frame is tall. Write it as one JavaScript file that draws on an HTML canvas with the 2D context. One function draws any moment: render(ctx, W, H, ph, colors), where ph is the loop phase from 0 to 1. Write every motion in whole turns of ph so the last frame flows into the first and the loop has no seam. No text, no logos, no images, no libraries. Scale every size from the shorter side of the canvas so it works wide, vertical and square. Take three colors as inputs: a background and two accents. Take the neutral colors for the glass, shadows and lines from the background so it also works on a dark or a light background.
The source kit
DownloadThe same code that is drawing the loop on this page. Unzip it, point your agent at START-HERE.md, and it can rebuild the loop and change it.
- LICENSE.txt1 KB
- PROMPT.md2 KB
- START-HERE.md1 KB
- animation.js8 KB
- core.js2 KB
- index.html1 KB
- render.py2 KB
Free to use and change for your own work. See the license.