Jump to content
GreenSock

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

how to define a variable in the timeline?

Recommended Posts


var state = true;

var tl = new TimelineLite();

tl.to(element, 1, {width:"50%"})

.to(element, 1, {backgroundColor:"#FF0000"}, "-=0.5")

.set(state = false) //something like for example

.to(element, 1, {width:"50%", onComplete:state = false}); //or as

 

Share this post


Link to post
Share on other sites

have you tried this:

var state = true;
var tl = new TimelineLite();
tl.to(element, 1, {width:"50%"})
  .to(element, 1, {backgroundColor:"#FF0000"}, "-=0.5")
  // using the call method in the timeline
  .call(function(){ state = false }) //something like for example
  .to(element, 1, {width:"50%"}); //or as

using the call() method in the timeline : http://api.greensock.com/js/com/greensock/TimelineLite.html#call()

  • Like 2

Share this post


Link to post
Share on other sites

the documentation says that i can call at any time

tl.call(func, ["param1"], this, 2);  //appends it at exactly 2 seconds into the timeline (absolute position)

I try to do so and does not work:

.call(function(){ console.log('call.3'); }, 3)

help please.

Share this post


Link to post
Share on other sites

his own answer

.call(function(){ console.log('call.3'); }, [], this, 3)

thanx

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×