user9154: 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.

user1950: You can loop over the range of frames from the start of the comp to the present and calculate the value along the way.
function myFuncf(theTime){
 //whatever the function you're using to create the value, e.g.
 t=theTime + s.valueAtTime(theTime); //s is the slider
 return t
}

firstFrame = timeToFrames(inPoint); //if you want it to calculate
                                    //from the beginning of the comp
                                    //change this to 0, or maybe 1?
                                    //I'd check but I'm rendering ATM

mytime=0; //initialise the mytime variable

currentFrame = timeToFrames(time);
for (int i=firstFrame; i <= currentFrame; i++){
  mytime += myFunc(framesToTime(i)); //need to convert frames back into seconds
}

after the loop myTime should be the sum of the results of function myFunc from all the previous frames up to and including the present one (I'm not 100% sure if the loop should end when i < cf or i <= cf, you might want to test).
note first time I posted this there was a mistake. Where I called the function I was giving it frames (from i the loop variable), but it uses valueAtTime which expects time in seconds, so you need to convert: mytime += myFunc(framesToTime(i));
If you have a long comp or this is applied to lots of layers, this expression may become slow to evaluate and cause lagginess. If it becomes a problem convert the expression to keyframes.

9154: <p>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.</p>

<p>Sounds complicated, I know. </p>

<p>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.</p>

<pre><code>myTime = timeToFrames(time);
</code></pre>

<p>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:</p>

<pre><code>//speed (gets tweened from a certain value range,for example: 10 - 1)
s = (some connected slider here)

myTime += s;
</code></pre>

<p>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.</p>

<p>What I get is only 2 + 8;</p>

<p>So I need to store the value at every frame. Is this possible? </p>

<p>Please help.</p>
 1950: <p>You can loop over the range of frames from the start of the comp to the present and calculate the value along the way.</p>

<pre class="lang-js prettyprint-override"><code>function myFuncf(theTime){
 //whatever the function you're using to create the value, e.g.
 t=theTime + s.valueAtTime(theTime); //s is the slider
 return t
}

firstFrame = timeToFrames(inPoint); //if you want it to calculate
                                    //from the beginning of the comp
                                    //change this to 0, or maybe 1?
                                    //I'd check but I'm rendering ATM

mytime=0; //initialise the mytime variable

currentFrame = timeToFrames(time);
for (int i=firstFrame; i &lt;= currentFrame; i++){
  mytime += myFunc(framesToTime(i)); //need to convert frames back into seconds
}
</code></pre>

<p>after the loop myTime should be the sum of the results of function myFunc from all the previous frames up to and including the present one (I'm not 100% sure if the loop should end when <code>i &lt; cf</code> or <code>i &lt;= cf</code>, you might want to test).</p>

<p><strong>note</strong> first time I posted this there was a mistake. Where I called the function I was giving it frames (from <code>i</code> the loop variable), but it uses <code>valueAtTime</code> which expects time in seconds, so you need to convert: <code>mytime += myFunc(framesToTime(i));</code></p>

<p>If you have a long comp or this is applied to lots of layers, this expression may become slow to evaluate and cause lagginess. If it becomes a problem convert the expression to keyframes.</p>
