Free tool · runs in your browser · nothing uploaded
Image-sequence packer
Turn numbered frames or a video into WebP frame sets for desktop and mobile, sized and named for a scroll-driven canvas. Preview the scrub, then copy the code.
1. Your frames
Your frames stay on your device. They are read and encoded by this browser tab and are never uploaded.
Frames in a folder?
Starting…
3. Your frame sets
Scrub with a slider
Drag to move through the frames. It draws only when the frame changes.
Move to scrub.
Scrub with scroll
Scroll inside the box, the way your page will drive it.
Scroll to scrub.
Copy-paste scrubber code
A pinned section that draws the sequence on a canvas as you scroll. It draws only when the frame index changes, loads the first frame first, lazy-loads the rest nearest-first, loads every other frame on slow or data-saver connections, and picks the mobile set on portrait phones. After you pack, the frame count and names below match your zip.
<!-- Scroll-driven image sequence. Files from the packer: desktop/frame_0001.webp … and mobile/frame_0001.webp … -->
<link rel="preload" as="image" href="desktop/frame_0001.webp" media="not all and (max-width: 700px) and (orientation: portrait)" fetchpriority="high">
<link rel="preload" as="image" href="mobile/frame_0001.webp" media="(max-width: 700px) and (orientation: portrait)" fetchpriority="high">
<section class="seq" id="seq" aria-label="Product chapter, controlled by scrolling">
<div class="seq-pin">
<canvas class="seq-canvas" role="img" aria-label="Describe what the sequence shows"></canvas>
<div class="seq-copy"><h2>Your chapter headline</h2><p>Scroll to turn the product.</p></div>
</div>
</section>
<style>
.seq { position: relative; height: 300vh; } /* taller = slower */
.seq-pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: #0e0d0c; }
.seq-canvas { display: block; width: 100%; height: 100%; }
.seq-copy { position: absolute; left: 0; right: 0; bottom: 8vh; padding: 0 16px; text-align: center; color: #fff; }
@media (prefers-reduced-motion: reduce) {
.seq { height: auto; }
.seq-pin { position: relative; }
}
</style>
<script>
// Canvas image-sequence scrubber.
// - Draws only when the frame index changes, never on every scroll event.
// - Loads the first frame first, then lazy-loads the rest, nearest to the current frame first.
// - On slow or data-saver connections it loads every other frame and shows the nearest one loaded.
function createSequenceScrubber({ canvas, count, src, concurrency = 6, startWhenVisible = true }) {
const ctx = canvas.getContext("2d");
const conn = navigator.connection || {};
const step = conn.saveData || /(^|-)2g$|^3g$/.test(conn.effectiveType || "") ? 2 : 1;
const frames = new Array(count); // decoded <img> per index, once loaded
const busy = new Set();
let want = 0, drawn = -1, running = 0, started = false, dead = false, draws = 0;
function nearestLoaded(i) {
for (let d = 0; d < count; d++) {
if (frames[i - d]) return i - d;
if (frames[i + d]) return i + d;
}
return -1;
}
function draw() {
const i = nearestLoaded(want);
if (i < 0 || i === drawn) return; // same frame as on screen: do nothing
const img = frames[i];
const dpr = Math.min(devicePixelRatio || 1, 2);
const w = Math.round(canvas.clientWidth * dpr), h = Math.round(canvas.clientHeight * dpr);
if (canvas.width !== w || canvas.height !== h) { canvas.width = w; canvas.height = h; }
const s = Math.max(w / img.naturalWidth, h / img.naturalHeight); // cover
const dw = img.naturalWidth * s, dh = img.naturalHeight * s;
ctx.drawImage(img, (w - dw) / 2, (h - dh) / 2, dw, dh);
drawn = i; draws++;
}
function load(i) {
busy.add(i);
const img = new Image();
img.decoding = "async";
img.src = src(i);
return img.decode().then(() => { frames[i] = img; }, () => {}).finally(() => {
busy.delete(i);
if (!dead) draw();
});
}
// Next frame to fetch: the closest one to the current position that isn't loaded yet.
function next() {
for (let d = 0; d < count; d++) {
for (const i of [want - d, want + d]) {
if (i >= 0 && i < count && (i % step === 0 || i === count - 1) && !frames[i] && !busy.has(i)) return i;
}
}
return -1;
}
function pump() {
while (!dead && running < concurrency) {
const i = next();
if (i < 0) return;
running++;
load(i).then(() => { running--; pump(); });
}
}
function start() { if (!started) { started = true; pump(); } }
// First frame right away, the rest once the canvas is near the viewport.
load(0).then(() => {
if (!startWhenVisible || !("IntersectionObserver" in window)) return start();
const io = new IntersectionObserver(es => { if (es.some(e => e.isIntersecting)) { io.disconnect(); start(); } }, { rootMargin: "100% 0px" });
io.observe(canvas);
});
const ro = "ResizeObserver" in window ? new ResizeObserver(() => { drawn = -1; draw(); }) : null;
if (ro) ro.observe(canvas);
return {
// p from 0 to 1
setProgress(p) {
const i = Math.round(Math.min(1, Math.max(0, p)) * (count - 1));
if (i === want) return;
want = i;
draw();
if (started) pump();
},
get index() { return drawn; },
get target() { return want; },
get loaded() { return frames.filter(Boolean).length; },
get draws() { return draws; },
get step() { return step; },
destroy() { dead = true; if (ro) ro.disconnect(); frames.length = 0; },
};
}
(() => {
const FRAMES = 60; // frames in each set
const PAD = 4, PREFIX = "frame_", SUFFIX = ".webp"; // frame_0001.webp, frame_0002.webp …
const section = document.getElementById("seq");
const dir = matchMedia("(max-width: 700px) and (orientation: portrait)").matches ? "mobile" : "desktop";
const still = matchMedia("(prefers-reduced-motion: reduce)").matches;
const scrub = createSequenceScrubber({
canvas: section.querySelector("canvas"),
count: still ? 1 : FRAMES, // reduced motion: first frame only
src: i => `${dir}/${PREFIX}${String(i + 1).padStart(PAD, "0")}${SUFFIX}`,
});
if (still) return;
let raf = 0;
const onScroll = () => {
if (raf) return;
raf = requestAnimationFrame(() => {
raf = 0;
const r = section.getBoundingClientRect();
const range = section.offsetHeight - innerHeight;
scrub.setProgress(range > 0 ? -r.top / range : 0);
});
};
addEventListener("scroll", onScroll, { passive: true });
onScroll();
})();
</script>Build a sticky, scroll-driven product chapter for my site in plain HTML, CSS and JavaScript (no libraries).
Files (in folders next to the page):
- desktop/: 60 frames, 1600 × 900 WebP, named frame_0001.webp upward.
- mobile/: the same 60 frames as a 720 × 1280 portrait cut, same names.
Behaviour:
1. A section 300vh tall with a sticky 100svh stage. A <canvas> fills the stage and shows the frames cover-fitted, sharp on high-density screens (devicePixelRatio capped at 2).
2. Map scroll progress through the section (0 to 1) to a frame index. Read the scroll in a requestAnimationFrame callback and draw only when the index changes.
3. Load the first frame first and preload it with <link rel="preload" as="image">. Lazy-load the rest once the section is near the viewport, nearest to the current frame first, six at a time. While frames arrive, draw the nearest one already loaded.
4. If navigator.connection reports saveData or a 2g or 3g connection, load every other frame only.
5. Use the mobile set on portrait screens up to 700px wide.
6. Next to the canvas (below it on mobile), show three short copy blocks for [FEATURE 1], [FEATURE 2] and [FEATURE 3] that fade in at 10–30%, 40–60% and 70–90% progress, plus a thin progress line along the edge of the stage.
7. With prefers-reduced-motion: reduce, show the first frame as a still and let the copy scroll normally.
8. Accessibility: the canvas has role="img" and an aria-label describing [PRODUCT NAME]; all copy is real HTML text with enough contrast.
Style: [describe your fonts, colours and mood]. Give me one complete HTML file.See the technique in a full page: the speaker product page template turns a rendered speaker with scroll, then explodes it into parts, using two image sequences.
Template that uses scroll sequences
The full prompt and code are free.
What the packer does
A scroll-driven image sequence is a stack of still frames, usually a 3D render of a product turning or coming apart, drawn on a canvas one at a time as the reader scrolls. This tool takes the raw frames, or a video that it samples into frames, and produces what the page needs: two sets of WebP images, one sized for desktop and one for phones, named in order and packed in a zip with a small sequence.json that lists the sizes. It shows the real weight of each set, and the preview runs the same scrubber code you copy, so what you see here is what your page will do.
When to use an image sequence
Use a sequence when the reader should control a short, precise motion: a turntable, an exploded view, a lid opening. Any frame can be shown instantly in either direction, frames can have a transparent background, and the result looks the same in every browser. The cost is weight, because every frame is a full image. For long footage, a scroll-scrubbed video is lighter; the scroll-video encoder prepares that.
Recommended settings
- Frames: 60 to 120 for a turntable, up to 180 for a longer chapter. Use the stride or the frame cap to cut a long render down.
- Desktop width: 1600 for a full-screen stage. 1920 only when fine detail fills the screen; 1280 when the canvas takes half the width.
- Mobile: 720 wide with a 9:16 crop, placed over the product. A landscape frame shrunk onto a portrait phone leaves most of the screen empty.
- WebP quality: 70 to 80. Renders on a plain background compress very well; noisy or detailed footage needs more.
- Weight: about 3 to 8 MB per chapter on desktop and 2 to 4 MB on mobile. The estimate updates as you change settings.
How the scrubber loads and draws
Four rules keep a sequence smooth. It draws only when the frame index changes, so fast scrolling doesn’t redraw the same image dozens of times a second. It loads the first frame before anything else, and the page preloads it, so the stage is never empty. It lazy-loads the rest once the section is near the viewport, six at a time, always fetching the frame nearest the current position next, and until a frame arrives it draws the nearest one that has. And when the browser reports a data-saver or 2G/3G connection, it loads every other frame, which halves the download and looks almost the same while scrolling.
Step by step
- Render or export your frames as numbered PNG, JPEG or WebP files, or drop a short video and pick a sample rate and trim.
- Choose the desktop width and, for phones, a width and a portrait crop. Drag the crop box onto the product.
- Set the quality, the stride or frame cap, and the name pattern. Watch the weight estimate.
- Press Pack frames, then scrub the preview with the slider and by scrolling the box.
- Download the zip, unzip it next to your page, and paste the code. The frame count and file names in the code already match.
The same with ffmpeg
From a video, sampled at 24 fps, for desktop and a centred 9:16 mobile cut:
mkdir -p desktop mobile
ffmpeg -i input.mp4 -vf "fps=24,scale=1600:-2" -c:v libwebp -quality 75 desktop/frame_%04d.webp
ffmpeg -i input.mp4 -vf "fps=24,crop=ih*9/16:ih,scale=720:1280" -c:v libwebp -quality 75 mobile/frame_%04d.webp
From numbered renders, keeping every second frame:
ffmpeg -framerate 30 -i render/%04d.png -vf "select='not(mod(n\,2))',scale=1600:-2" -fps_mode vfr \
-c:v libwebp -quality 75 desktop/frame_%04d.webp
Then pack both folders without recompressing: zip -0 -r sequence.zip desktop mobile.
FAQ
Are my frames uploaded?
No. The frames or video are read and encoded by your own browser and never leave your device. The page only downloads its own code and a small zip library from a public CDN.
How are the frames ordered?
By file name, in natural order, so frame_2 comes before frame_10. Leading zeros are not required. If you drop a folder, the order follows the path inside it.
Image sequence or scroll-scrubbed video?
A sequence shows any frame instantly in both directions, can have a transparent background and looks the same in every browser, but it is heavier: every frame is a separate image. Video is lighter for long footage. Use a sequence for short turntables and exploded views of 60 to 180 frames, and video for longer clips.
How heavy should a sequence be?
Aim for about 3 to 8 MB per chapter on desktop and 2 to 4 MB on mobile. Only the first frame blocks the first paint; the rest load in the background, nearest frames first.
Why does the output have two folders?
desktop/ holds landscape frames at the desktop width, and mobile/ holds a smaller set, cropped to portrait if you chose that. The code picks one set when the page loads, so a phone never downloads the desktop frames.
Can I use the output and code commercially?
Yes. The tool is free, the frames are your own, and the scrubber code is free to use on any site without credit.