Changing a Variable Over Time
by Thomas MaCoy on May 6, 2012 at 11:37:14 pm
This is one of those things that I assume is either really easy or really hard to do. I have a variable that AS3 assigns some different values to at a couple points in a project (in this case to adjust volume). Normally when you assign a new value, say slider.x = 1, the adjustment is instantaneous. Is there anyway to make a new value assignment gradual? So if slider.x = 1, and the project calls a line of code that says slider.x = 100, I can have that transition over a few seconds rather than instantly? Either by telling it to slowly transition, or by some kind of trick like having it add 5 to slider.x per second for the next 20 seconds?
Thanks for any advice.
You could also use an ENTER_FRAME listener, but TweenMax allows you to do it with less code.
General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.