Jump to content
Search Community

Can you live update a physics tween?

Luckyde test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hey i'm trying to figure out something

Say 2 objects are colliding and I'm doing something like

 

TweenLite.to(tiles[0], 2, {physics2D:{velocity:400, angle:0}, onUpdate:checkCollision});

function checkCollision(){
  var colliding = Draggable.hitTest(this.target, tiles[5]);
  if(colliding){
    TweenMax.killTweensOf(this.target);
  }
}


What i want instead is to update the original tween's velocity/angle to be smaller and not kill the tween. Is that possible or do i have to make a new tween?


Thanks!

Link to comment
Share on other sites

Why don't you want to kill it? Is it causing a jump when you create a new one? Or are you trying to keep the duration the same?

 

Do you think you can make a simple demo of what you're trying to do? There might be some other approaches if I can see what's going on. You can use the physics plugins on CodePen by using the url from here.

 

See the Pen OPqpRJ by GreenSock (@GreenSock) on CodePen

 

 

  • Like 4
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...