Is there any easy way to tween the time in the example below. So for example, the first duration of the first oject in the array would be 0.35 and the the last duration of the last oject would be 1.55.
//original without tweening the duration
TweenMax.staggerFrom(split.chars, 0.35, { opacity: 0, top: "-5", rotationX: '-180deg', transformPerspective: 1500, ease: Sine.easeOut, force3D:true }, 0.05);
//current solution - (current problem: I have to wait for my "timeArray" values to be updated with values from the 1st tween)
var trainElm = document.getElementById('train'); var split = new SplitText(trainElm, {type:"chars,words,lines", charsClass:"char chars++", linesClass:"line++", wordsClass:"word++", position:"relative"}); var charArray = document.getElementsByClassName("char"); var invidDuration = 0.35; var invidEndingDuration = 1.55; var obj = {time:invidDuration}; var staggerAmnt = 0.05; var staggerTotalAmnt = staggerAmnt * split.chars.length var totalTime = staggerTotalAmnt + invidDuration; var timeArray = []; TweenMax.to(obj, totalTime, {time:invidEndingDuration, ease:Sine.easeOut, onUpdate:newTime, onComplete: animateIn}); function newTime() { timeArray.push(obj.time); } function animateIn() { for (i = 0; i < timeArray.length; i++) { var newDelay = i * staggerAmnt; TweenMax.from(charArray, timeArray, { opacity: 0, top: "-5", rotationX: '-180deg', transformOrigin: '50% 50%', ease: Sine.easeOut, force3D:true, delay: newDelay }); } };