# Problems with GLTFLoader and GSAP

**URL:** https://discourse.threejs.org/t/problems-with-gltfloader-and-gsap/43424
**Category:** Questions
**Tags:** loaders, animation
**Created:** [October 9, 2022, 11:44pm UTC](https://discourse.threejs.org/t/problems-with-gltfloader-and-gsap/43424 "2022-10-09T23:44:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mahmud\_hussin\_Mohamed](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mahmud_hussin_mohamed/32/26712_2.png) [@mahmud\_hussin\_Mohamed](https://discourse.threejs.org/u/mahmud_hussin_Mohamed)
#### Post date: [October 9, 2022, 11:44pm UTC](https://discourse.threejs.org/t/problems-with-gltfloader-and-gsap/43424/1 "2022-10-09T23:44:42Z")

</div>

I have one glTF model with two animations i used mixer with GSAP scrolltrigger to run animation[0] in section-four i want to run animation[2] in section-five, this is my code and the live example:

```javascript
const assetLoader = new GLTFLoader();

var mixer;
var model;

assetLoader.load("https://cdn.glitch.global/5213cd0b-d594-4b34-9064-2f1f38b42c78/cube33.glb?v=1665271977633", function(gltf) {

  gltf.scene.traverse(function (node) {
    if (node instanceof THREE.Mesh) {
      object.frustumCulled = false;
      node.castShadow = true;
      node.material.side = THREE.DoubleSide;
    }
  });

 model = gltf.scene;
 model.scale.set(1,1,1)

 model.position.setY(-1);
 model.position.setX(2);  
 model.position.setZ(-2);

 model.rotation.x = Math.PI / 2;
 
 model.rotation.y = Math.PI / 2;
 
 model.rotation.z = Math.PI / -2;
  scene.add(model);
  
  camera.position.z = 4; 

          /// MIXER&ACTION CONFIG///

    mixer = new THREE.AnimationMixer(model);
    var action = mixer.clipAction(gltf.animations[1]);
    action.play();

    createAnimation(mixer, action, gltf.animations[1]);
  }
);

var clock = new THREE.Clock();
function render() {
  requestAnimationFrame(render);
  var delta = clock.getDelta();
  if (mixer != null) mixer.update(delta);

  renderer.render(scene, camera);
}

render();

function createAnimation(mixer, action, clip) {
  let proxy = {
    get time() {
      return mixer.time;
    },
    set time(value) {
      action.paused = false;
      mixer.setTime(value);
      action.paused = true;
    }
  };

        /// GSAP CONFIG///

function GSAP(){

  ////gsap////
       /// I just runed ANIMATION [0] HERE ///
let scrollingTL = gsap.timeline({
    scrollTrigger: {
		trigger: ".section-four",
     ease: "Power4",
      end: '+=5000px',
      pin: true,
      scrub: 2,
      onUpdate: function () {
        camera.updateProjectionMatrix();
      }
      
    }

  });
  scrollingTL.to(proxy, {
    time: clip.duration,
    repeat: 0,
  })
       /// I NEED TO RUN ANIMATION [1] HERE ///
  let scrollingTL1 = gsap.timeline({
    scrollTrigger: {
		trigger: ".section-five",
    ease: "Power4",
    end: '+=5000px',

      pin: true,
      scrub: 2,
      onUpdate: function () {
        camera.updateProjectionMatrix();
      }
      
    }

  });
  scrollingTL1.to(proxy, {
    time: clip.duration,
    repeat: 0,
  })

 

}

```

this is the live code : [competent-keldysh-7m1ihp - CodeSandbox](https://codesandbox.io/s/competent-keldysh-7m1ihp?file=/index.html:0-8191)

---

<div class="post-metadata">

### Author: ![mahmud\_hussin\_Mohamed](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mahmud_hussin_mohamed/32/26712_2.png) [@mahmud\_hussin\_Mohamed](https://discourse.threejs.org/u/mahmud_hussin_Mohamed)
#### Post date: [October 10, 2022, 1:29pm UTC](https://discourse.threejs.org/t/problems-with-gltfloader-and-gsap/43424/2 "2022-10-10T13:29:08Z")

</div>

@Mugen87 Mugen87 thanks for edite i hope to see giudelines on this issue please also , thanks mate
