Hello,
I'm having issues trying to animate a custom property of a DOM object using TweenMax. What I'm trying to do is actually very simple, I just need to tween this "currentFrame" property from 0 to 100 so that I can use its value to update theElement with a certain CSS class.
Please see below. I'm obviously using the JavaScript library.
var updateCallback = function(theElement) {
console.log(theElement.currentFrame); // returns undefined
}
var theElement = $(".box");
// theElement.currentFrame = 0; // uncommenting this line makes the callback function always return 0
TweenMax.fromTo(theElement, 2,{ currentFrame: 0, autoCSS: false}, { currentFrame: 100, autoCSS: false, onUpdate: updateCallback, onUpdateParams: [theElement] });
What could be wrong my approach? The value of "currentFrame" is always numeric, so my hope is that TweenMax can animate it from 0 to 100 in 2 seconds, calling that "updateCallback" each time the value of "currentFrame" changes. So "updateCallback" would fire a total of 100 times and have access to the updated "currentFrame".
Any ideas?
Thanks in advance!
Andre