I have following problem: I am trying to tweak the speed of a Math.sin function. Therefore I need a variable that incerements over time with a combination of a keyframed speed variable.
Sounds complicated, I know.
Let's say I am using the global time variable and convert it with the timeToFrames() function I get an integer value for each frame.
myTime = timeToFrames(time);
This leads me to a value of 1 for Frame 1, a value of 2 for Frame 2, and so on. But what if I want to manipulate the increment. For example:
//speed (gets tweened from a certain value range,for example: 10 - 1)
s = (some connected slider here)
myTime += s;
If I have a speed of 10 at Frame 1 I would get a value of 11. If I have a speed of 8 at Frame 2, I would expect a value of 11 + 2 + 8 = 21.
What I get is only 2 + 8;
So I need to store the value at every frame. Is this possible?
Please help.
var x = 10;
or dynamic:var x = value
and use the addition assignment operator+=
(x += 5
), but this is just the shorthand ofx = x + y
.var lastframe = yourCalcValue;
or calculate both values from the current and the last frame at once?