Jump to content
GreenSock

stot

Set boolean value in tween / timeline

Recommended Posts

Hi Guys,

 

I try to set a boolean value in the TimelineMax.set() method, like this:

tl.set(toAnimate, {
        y: 50,
        visible:"true",       // also tried visible:true
        alpha: 1
    })

But this gives me a NaN value of the visible property of my toAnimate object. But neither visible:"true" nor visible:true are working.

 

The solution using a callback seems for me a bit over sized (see here http://greensock.com/forums/topic/2456-tweening-boolean-value/)

 

Is this the only solution?

 

 

Link to comment
Share on other sites

set() is a zero duration tween ... and tweens are valid for properties with numerical values. I believe that is your issue here (I could be wrong though :) ).

  • Like 1
Link to comment
Share on other sites

Yup, Shaun is correct, TweenLite will not tween String values. 

Another idea is to use 0 and 1 instead of false and true.

 

Since this is part of a timeline you can either put an onStart callback on your set() or use a separate call() to run a function that will modify toAnimate.visible. 

 

EDIT: after reading GreenSock's post below, I just want to clarify that I was assuming that toAnimate was a generic JS object and not a DOM element like:

 

var toAnimate = {y:20, visible:"true, ...};

  • Like 1
Link to comment
Share on other sites

Are you trying to animate a DOM element's "visibility" property or something? If so, it'd be visibility:"visible", not visible:true. 

  • Like 1
Link to comment
Share on other sites

thanks for all the answers. toAnimate is an easeljs bitmap.

It seems that omitting the callback is not an option since 0 and 1 will not work.

 

thanks anyways

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