GSAP Video Scroll

Let visitors scroll through a video, frame by frame.

A real video that plays forwards and backwards with the scroll, powered by GSAP — the section holds still while visitors move through it, with captions that fade in and out at the moments you choose.

Gutenberg block

Requirements

  • The block editor (Gutenberg)
  • WordPress 6.5 or newer
  • PHP 7.4 or newer
  • Moduly with GSAP built in (the release after 0.4.2). On an older Moduly the video shows with normal play controls.

Prepare the video

Scrubbing jumps to a new moment many times a second, and a browser can only show a frame quickly when the file has a keyframe close to it. Ordinary camera and web exports have one keyframe every few seconds, so they seek in visible steps. Re-encode the clip with frequent keyframes and no sound:

ffmpeg -i input.mov -an -c:v libx264 -g 5 -crf 23 -pix_fmt yuv420p -movflags +faststart scroll.mp4
  • -g 5 puts a keyframe every 5 frames; -g 1 (every frame) is smoothest but makes a bigger file.
  • -an drops the sound — the video always plays muted.
  • Keep it short and modest in size (a few seconds, 1280–1920 px wide, under ~30 MB) so it can be preloaded whole.

Add it to a page

  1. Open the page or post in the block editor.
  2. Click + (Block Inserter) and search for GSAP Video Scroll — it is in the Moduly · GSAP category. Two ready-made layouts are under Patterns → Moduly (pick your video after inserting one).
  3. Choose a video from the media library, upload one, or paste a direct video link.
  4. Add a poster and captions and style it in the right sidebar (Block tab).

Settings

Video

SettingWhat you can set
SourceMedia Library, External URL (a direct .mp4 / .webm link, not a YouTube or Vimeo page) or Image sequence
Video / Video URLThe clip to scrub
Frames · Load frames · Image smoothingImage sequence: the images in the gallery's order (same size, 30–150 of them scrub well), loaded as the section comes near or with the page; Crisp keeps hard pixel edges when scaled
Poster imageShown until the video loads and to visitors who prefer reduced motion
Accessible descriptionWhat the video shows, for screen readers. Empty: treated as decoration while it scrubs
Preload whole file up to (MB)0–200. Smaller files are downloaded completely as the section comes near; larger ones are buffered by the browser

Scroll

SettingWhat you can set
PlaybackScrub with the scroll (default) or Play in view — the video plays on its own while it is on screen and pauses when it leaves (not for image sequences)
Loop · Show controlsPlay in view only: start again at the end; show play, pause and the timeline
Hold the sectionOn: the video stays on screen while visitors scroll through it. Off: it plays through as it scrolls past
Scroll lengthFirst frame to last, in % of the screen height (50–1000), with its own length for tablets and phones
Top offsetRoom for a sticky header while the section is held, 0–300 px — or 0–50 vh to stop the section part-way down the screen
Scroll smoothing (s)0–3 · higher values glide to the new frame
Starts when the top reaches (%) · Ends when the bottom reaches (%)Not held, or playing in view: where on the screen the effect starts and stops, 0 = top edge, 100 = bottom edge. Reset: automatic (100 / 0 when scrubbing, 90 / 10 in view)
Play from · Play to (% of the video)Use only part of the video or of the frames, e.g. 20–80
On phonesSame effect, or Still — the poster (or the first frame) and a normal video

Captions

SettingWhat you can set
CaptionsAdd, remove, duplicate and reorder. Each has a title, text, Show from (%) and Hide at (%) of the scroll, and one of nine positions
Title tagH2–H4, div or p

Look

PanelWhat you can set
Video lookAn aspect ratio instead of a height, or a height (vh or px, and a height for phones), Cover, Contain, Stretch or Natural size, border radius, a shade to help captions read
Caption lookMax width (px or %), distance from the edges, padding, radius, title and text size
ColoursVideo background, shade, caption background, caption title and text

Styles tab: font family and top/bottom margin. Wide and full width are in the toolbar.

Good to know

  • The video is always muted and plays inline, which is what lets browsers scrub it without a tap.
  • On iPhone and iPad the first touch on the page quietly unlocks the video so it can be scrubbed.
  • A video on another site preloads whole only if that site allows cross-origin requests; otherwise the browser buffers it normally.
  • In the editor the video scrubs as you scroll the canvas, but the section is never held; preview the page to see it held.
  • Visitors who ask their device for reduced motion get the poster (or the first frame) and a normal video with controls, with the captions listed under it.
  • An image sequence needs no special encoding and scrubs evenly in every browser, but every frame is a download: keep the count and file sizes modest, and use Load frames: as the section comes near further down a page.
  • Play in view always starts muted — browsers only autoplay silent video.

Troubleshooting

  • Scrubbing steps or stutters? The file needs more keyframes — see Prepare the video.
  • Nothing moves on another site's URL? Check the link opens the video file itself.
  • Nothing moves at all? Check Moduly is up to date — the block uses the GSAP it ships.
  • A change not showing on the live site is almost always a page cache — clear your caching plugin or host cache.