Jump to content
Search Community

'undefined' are computed ?

jonForum 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

Hi guys, when call a easing, and pass 'undefined' to a property, it seem to be computed !!
so if i try this  moveTo(1,1200); the y semm invalid, but it set to undefined ! 
What the way to avoid compute a x or y in this case. ?

    moveTo(messageID,tX,tY){
        if(this.lists[messageID]){
            const data = this.lists[messageID];
            TweenMax.to(data.cameraBoneXY, 1, {
                x: isFinite(tX)? tX-data.globalMessageXY.x : void 0,
                y: isFinite(tY)?-tY+data.globalMessageXY.y : void 0,
                ease: Elastic.easeOut.config(0.9, 0.4),
            });
            TweenMax.to(data.cageTxt, 2, {
                x: isFinite(tX)? tX-data.globalMessageXY.x+70 : void 0,
                y: isFinite(tY)? tY-data.globalMessageXY.y-30 : void 0,
                ease: Elastic.easeOut.config(1, 0.2),
    
            });
        };
    };

thank you for help me understand this issue.

Link to comment
Share on other sites

Are you saying you want to completely remove the inline transform property from your element? Or are you trying to just keep it at whatever it is at that moment (no change)? If you want to remove it completely, use clearProps. Otherwise, you could use "+=0" relative value, or just don't populate that property in the vars at all. For example: 

var vars = {};
if (...) {
  vars.x = tX-data.globalMessageXY.x;
  vars.y = -tY+data.globalMessageXY.y;
}
...
TweenMax.to(data.cameraBoneXY, 1, vars);

 

Or maybe I misunderstood what you're attempting. 

  • Like 1
  • Thanks 1
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...