Let say I want to make the opacity of my sprite from 100 to 50 in 1 second.
I just want to specify the base value, the final value, and the duration, so the transition will be as smooth as possible and I won't bother with events like "every 0.1 sec -> decreases opacity by 5" and stuff.
I guess this is very simple, but I didn't figure out how to do it.
Coin-coin le Canapin wrote:I read the tutorial about dt, but I didn't figured out how to achieve what I want.
Thanks for the short version. How can I add a "duration" parameter to this ?
dt is your time - every second it will add up to more or less 1 - so if you do something like Value + dt*50 - within one second that value will go up by ~50. If you do dt*25 then it will take 2 seconds and so on.
Just understand that there's no limit to it, hence the "If value >50" in my example, otherwise if, for example you do an "Every tick" condition it'll just endlessly add 50 every second. Which is one reason why the Tween plugins mentioned by codah are pretty neat.