Jump to content
Search Community

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

gaggo test
Moderator Tag

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

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.
×
×
  • Create New...