SR.
โ† All guides

Animation

GSAP ScrollTrigger: map scroll position to film frames

Want visitors to stop a scene with their thumb and find the same moment on the way back? Derive the frame from page position. ScrollTrigger exposes progress between 0 and 1 across a scene.

Choose the frame

In an example sequence of 101 frames numbered 0 to 100, the midpoint displays frame 50. In GSAP you can read self.progress in onUpdate.

const frame = Math.round(progress * 100);

Test the sequence

Mark a halfway position, reach the end and return to the mark. The frame should match. Repeat after rotating the phone. If the scene is already sticky in CSS, check that adding a pin does not introduce extra space. Provide a link to skip the sequence.

Before installing

Review the origins of plugins, images and scripts in example projects. Read any agent instructions before opening a project with an automated tool.

Prompt injection checks

greensock/GSAP ยท Official documentation