Play animation with scroll

Hi, have a nice day, i try to find a way to play animation with scroll using gsap

 let scrollingTL = gsap.timeline({
            scrollTrigger: {
                trigger: canvas,
                start: 'top top',
                end: '+=500%',
                pin: true,
                scrub: true,
                onUpdate: function () {


            .from(mesh.animation, {
            }, 0)

any help plz?

Does the following topic solve your issue? The questions seem to be quite similar.

Oh i am sorry if i explain wrong , but my english is bad , i mean play mesh animation based on scroll , this animation

mixer = new THREE.AnimationMixer(gltf.scene)

         const action = mixer.clipAction(gltf.animations[0])


Do you mean you want to trigger the animation at a certain scroll position?

Yes, something like this .

Try it like so:

The idea is to add an onEnter() callback function which is executed when the scroll position moves forward past the start. Use it to start your animation. If you want to execute this callback only once, set the respective configuration property to true.

The callback and the property are documented right here: Docs - GreenSock

1 Like

Yes but when i set the animation on enter all animation loaded in one time, i need to load animation based on scroll , is that can be made ? plz

@lolia try like this…?

let oldValue = 0;

window.addEventListener('scroll' , function(e){

var newValue = window.pageYOffset;

if(oldValue - newValue < 0){
    mixer.update( (newValue - oldValue) / 250 );
else if(oldValue - newValue > 0){
   mixer.update(  (newValue - oldValue ) / 250 ) ;
oldValue = newValue;
1 Like

Yes i try this but i want to use gsap for more control

This is not working on mobile - the timing is completely off as is the animation.