Jump to content
Search Community

is it possible to access to time duration in on Update Param?

Sanprieto test
Moderator Tag

Go to solution Solved by akapowl,

Recommended Posts

12 minutes ago, ZachSaucier said:

Just noting that this refers to the tween in an onUpdate if you don't use an arrow function so you don't need a variable reference to the tween:


onUpdate: function() {
  console.log(this.time());
}

 

okay thanks for advice!!

Link to comment
Share on other sites

3 minutes ago, ZachSaucier said:

Sure. 


onUpdate: function() {
  console.log(this.time(), this.targets()[0])
}

 

I'm working with three.js and the object is a mesh and with gsap animation the position. But I want to access to the mesh ( 3D object)
 

    gsap.to( object3D.position, { duration: 10, motionPath: {
       path: gsapPath,
       type:'cubic',
       },onUpdate: this.runGsap, onUpdateParams: [ object3D, this.startHSL, this.sizeHSL, 10 ]
    })

I pass like parameter object3D in onUpdateParams but I think It isn't necessary. In this case with targets[0] I have the vectors of position.

 

Link to comment
Share on other sites

21 hours ago, Sanprieto said:

I'm working with three.js and the object is a mesh and with gsap animation the position. But I want to access to the mesh ( 3D object)
 


    gsap.to( object3D.position, { duration: 10, motionPath: {
       path: gsapPath,
       type:'cubic',
       },onUpdate: this.runGsap, onUpdateParams: [ object3D, this.startHSL, this.sizeHSL, 10 ]
    })

I pass like parameter object3D in onUpdateParams but I think It isn't necessary. In this case with targets[0] I have the vectors of position.

 

 

I guess GSAP is animating the property's position of the object. It isn't a problem to pass object like parameter. 


Thank you very much for your answers !!!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...