Jump to content
Search Community

Custom Obj Property Values

RenanSantos 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

I'm trying to tween a custom object property with string values, but they are changed to NaN.

Why are they been treated as number?

 

 

.fromTo(_bg, 0.7,
                        {
                            currentBg:'bg1', 
                            curentBgType:'gradient',
                            ratio:0                            
                        },
                        {                            
                            currentBg:'bg2', 
                            curentBgType:'gdImg',                           
                            ratio:1                            
                        },0.001
                    )
 

 

Link to comment
Share on other sites

Hi Renan,

 

I'm not so sure I follow what you are trying to do here.

 

What types of intermediate values are you expecting when tweening the String "gradient" to "gdImg".

 

In order for TweenLite to tween something it must be a numeric value. 

 

If we can understand the end goal better, perhaps we can provide a suitable solution.

Link to comment
Share on other sites

Thanks for the answer Carl.

I was expecting a behaviour like the css visibility or position properties, since their values are strings.

The set method also returns NaN.

Obj.a = "A";

TweenMax.set(Obj, {a:"B"});

//Obj.a = NaN

I'm on my iPad now. I don't remember for sure if the result was NaN or if nothing happened.

Link to comment
Share on other sites

You're probably thinking of CSSPlugin's behavior in handling non-numeric css-related values like display:"none". But that's only for DOM elements and their css-related stuff. That functionality (applying strings) isn't baked into the core because frankly I don't think anyone has ever requested it nor have I ever had a need for it personally in all my years of doing interactive projects but maybe there's something we're missing - can you describe a real-world use case for something like this that wouldn't be better served by just setting the value directly like Obj.a = "B" in your example? Keep in mind you could use an onStart/onUpdate/onComplete to set a value if you want. 

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...