Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
gaggo

TweenMax.updateTo() in GSAP V.3.X?

Recommended Posts

Hey gaggo. Could you please give us some context (hopefully a simple CodePen)? We're happy to be happy to help craft a solution. It should be entirely doable with some custom code but TweenMax.updateTo() was rarely used by anyone and we cut it to reduce file size and API surface area :)

Link to comment
Share on other sites

Hi Zach, thanks for your swift answer! :)

 

I made a pen with gsap 2.x:

 

See the Pen yLeaYwR by hirasso (@hirasso) on CodePen

 

Basically I want the position of my mouse (or devicemotion on mobile) not to be applied immediately, but rather with gsap's great easing capabilities.

 

I'd like to migrate this to GSAP V.3

 

 

Link to comment
Share on other sites

For that sort of thing we recommend using GSAP 3's quickSetter() for performance. We even have a mouse follower demo on the docs page for it :) https://greensock.com/docs/v3/GSAP/gsap.quickSetter()

 

You're free to edit your previous messages as you see fit, though we ask that you don't make the posts completely unusable for future readers :) 

Link to comment
Share on other sites

Ah, I see... in the quickSetter mouse follow example, I can see the good old dummy ease I always used back in the days:

 

pos.x += (mouse.x - pos.x) * speed;
pos.y += (mouse.y - pos.y) * speed;

So no more support for GSAP's great easing functionality? I especially love `CustomEase` ...

Link to comment
Share on other sites

55 minutes ago, gaggo said:

So no more support for GSAP's great easing functionality? I especially love `CustomEase`

Of course you can use CustomEase instead. Easing functions are just functions that take a number between 0 and 1 and return a number between 0 and 1 :) 

 

If you're going to do that then it likely makes more sense to use tweens that kill off previous tweens:

See the Pen rNxMebJ?editors=0010 by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

Wow Zach, things can be so simple!! :) This is what totally solved it for me:

 

tweenMousePosition(newPos) {
  gsap.to(this.mousePos, 0.8, {
    x: newPos.x,
    y: newPos.y,
    onUpdate: () => this.adjustMask(),
    ease: "power4.out",
    overwrite: "auto"
  });
}

Thanks so much for your help!!

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.

×