James Hopkins
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by James Hopkins
-
-
A bit of background:
- On bootstrap, I'm using jQuery's .data() to store a (paused) TweenLite object against an associated DOM element - there are 10 of these such elements.
- I'm then iterating through these DOM elements, and appending a cloned TweenLite object to an array.
The reason I need to clone (using jQuery.extend()) each TweenLite object is because I don't wish to use the reference-based relationship that .data() uses; I simply want a clone of the object.
However, when I try this, I get an uncaught exception thrown, Cannot add [object Object] into the timeline; it is not a tween, timeline, function, or string. How can I get around this?
My codepen is
Thanks for any help in advance
Cheers
James
-
There's nothing stopping me doing that; it's just a case of neatness
Using the function invocation method, I was able to simply parse object literals directly into the method, and modify those object keys directly from within the invocation (having initially paused the tween). However it seems that using the TimelineLite constructor in this way, I need to firstly employ an arguably superfluous variable reference in which to store my object laterals.
The reason for the post as simply to make sure I wasn't missing anything obvious! -
Cheers for the (incredibly) swift response, guys. My codepen example of my previous attempt which works (with a simple TweenLite instance) is at
See the Pen CheFB by anon (@anon) on CodePen
. The issue is that I'm not sure if I can access vars in the same way using the TimelineLite constructor approach. I'm likely to have around 10 .fromTo() instances in my Timeline, and I want to selectively amend fromVars and toVars objects on a particular instance.Although offset is a string, it will become a variable, whereby it's value will depend based on a condition.
-
Hi there,
I'm creating a TimelineLite instance, and added a fromTo() method. I've created both fromVars and toVars using object literal syntax, but I need to be able to have several keys as variables (left or right CSS offsets depending on a condition) - so I need to use bracket notation.
I had used TweenLite previously using the non-OO style, and was able to initially pause the fromTo() method, modify the previously-set CSS properties using var and it's child property startAt, and then resume the tweens.
Is there any way of achieving the same thing using TimelineLite in the OO style?
Thanks for any help in advance.
James
Method needed to clone a TweenLite object so it be parsed into a TimelineLite instance
in GSAP
Posted
Thanks for the reply, Jamie.
Yes, I believe what you're alluding to would work; I just wanted to try and mitigate the overhead in instantiating multiple tweens on this event.
Cheers
J