Hey fellows,
it's late here, I'm pretty tired - oh New Year's Day is coming
. So just a short question: How do I use Gtween to a) constantly tween between two values - lets say alpha 1.0 to 0.0 and b) stop this tween at any time?
Thanks a lot for your input!
Comments
suppose that at the beginning the alpha is 1. then this will pulsate:
function startPulsate(sprite)
sprite.tween=GTween.new(sprite, 0.5, {alpha=0}, {ease = easing.linear,reflect=true,repeatCount=0})
end
function stopPulsate(sprite)
if sprite.tween then sprite.tween:stopAll() end
sprite.tween=nil
end
Fragmenter - animated loop machine and IKONOMIKON - the memory game
function startPulsate(sprite)
if not sprite.tween then sprite.tween=GTween.new(sprite, 0.5, {alpha=0}, {ease = easing.linear,reflect=true,repeatCount=0})
else sprite.tween:setPaused(false)
end
end
function stopPulsate(sprite)
if sprite.tween then sprite.tween:setPaused(true) end
end
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Btw: I clean up the tween after it ended. Just because I read somewhere, that Gtween holds a reference to the sprite and it doesn't feel to good to me...
also, does it matter if the tween is paused or not?
Fragmenter - animated loop machine and IKONOMIKON - the memory game