Why does this fail?
I love the transition library (over event based animation) but really miss some of the extra Flash style tweening library parameters like “repeat” and “yoyo” to create scrolling backgrounds, glowing lights, or any repeating movements. It seems I should be able to use the onComplete but can’t get it to work. Something about tail calls?
--trying to get a display object to fly across the screen repeatedly
local function = loopingAnimation (target)
myArt.x=0
transition.to (myArt, {time=2000, x=500, onComplete=loopingAnimation})
end
i’d do it like this so that it’s a re-usable function. note I had to define one of my function variables in advance because they call each other, but Lua seems to read linearly so loopingAnimation won’t know what loopingAnimationComplete is otherwise since it’s defined below it (or vice versa)
[lua]local loopingAnimationComplete
local loopingAnimation = function(target)
target.x=0
transition.to(target, {time=2000, x=320, onComplete=loopingAnimationComplete})
end
loopingAnimationComplete = function(event)
print(“complete”)
loopingAnimation(event)
end
ball2.y=50
ball2.y=150
I posted this a while ago but that was during the crush to get the SDK out and I know you guys were crazy busy. In a nutshell, I think all of us coming from Flash development would benefit from parity with “industry standard” Flash tweening libraries like TweenLite/Max
Some of the things I mention in the post are new (repeat, repeatDelay, yoyo) some are simply adding convenience to the syntax of your existing API (onStartAt, etc…)
I rely on TweenLiteMax for nearly everything (tweening volume, tweening “frames” within traditional clips, etc…)
Are there other params in TweenLite/Max along the lines of (repeat, repeatDelay, yoyo) that are super useful?
[import]uid: 26 topic_id: 3504 reply_id: 11536[/import]
I find that whenever I choose to use the transition API’s it’s a sort of “style” of coding and I like to stay in the rhythm of it’s syntax instead of mixing in “enterFrame listeners” or “timer.performWithDelay”. When you guys are ready to expose OpenGL blur, shadow, glow, and various blend modes your transition library will be a great syntax for making it easy to work with those features.
I also make frequent use of these features…
2.)“allTo” (targets:Array, duration:Number, vars:Object, stagger:Number = 0, onCompleteAll:Function = null, onCompleteAllParams:Array = null) Tween multiple objects to the same end values.
a.) “allFrom” Exactly the same as TweenMax.allTo(), but instead of tweening the properties from where they’re at currently to whatever you define, this tweens them the opposite way - from where you define TO where ever they are when the tweens begin
b.) “allFromTo” Tweens multiple targets from a common set of starting values to a common set of ending values; exactly the same as TweenMax.allTo(), but adds the ability to define the starting values.
3.) “delayedCall” - handy syntax, as a companion to “timer.performWithDelay” but for the transition API?
4.) “frame” Tweens a MovieClip (or spritesheet) to a particular frame number.
5.) “volume” Tweens the volume of an object with a soundTransform property (MovieClip/SoundChannel/NetStream, etc.).