Jump to content

Mr Pablo

How to change a timeline parameter that has already been set?

Recommended Posts

I have a basic timeline where I am setting the X parameter based on the width of a DIV.


After the timeline completes, I am changing the DIV content, and the width changes.


How would I go about changing what the X parameter is, now that I have changed what it's initial value was.


Pseudo-code example:


var width;


width = $(div).width();


timeline =  timeline.fromTo( ($(div), time, { x: 0 }, { x: width } );


function ontimelinecomplete {

    $(div).content(new content), width = $(div).newWidth()



This is what I have currently, but the timeline still uses the original width.

Link to comment
Share on other sites

What if I'm using fromTo?


That uses two sets of values and I only need to change the second, "to", value.




You can see here, I am trying to get timeline.vars.css, but it returns undefined.

Link to comment
Share on other sites

for .fromTo() tweens do like this :

var Tween = TweenMax.fromTo(".red",10,{x:0},{x:100});

var tl = new TimelineMax();
  .to(".blue", 2, {x:100});

$("#change").on("click", function() {
  Tween.vars.startAt.x = 200; // from value
  Tween.vars.css.x = 500; // to value
  • Like 1
Link to comment
Share on other sites

Please see my edit above, I cannot access vars.css or vars.startAt either, for my timeline.

Link to comment
Share on other sites

I don't see in your code where you're trying to access the vars.

Link to comment
Share on other sites

Crap, the jsfiddle didn't save, I have fixed it.




towards the bottom, in the changeFeedContent function, I get undefined for timeline.vars.startAt and css

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.