language: C++ 4.7.2 (gcc-4.7.2)
date: 76 days 17 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//Convience functions that scale the result for you, scaling both the duration and the value.
float ScaledEase(const EaseFunction &easeFunction, float currentTime, float startPos, float stopPos, float startTime, float stopTime)
{
    //Get the range of the values.
    float timeRange = (stopTime - startTime);
                
    //Adjust the position from (begin, end) to (0, range), and convert to float.
    float adjustedTime = (currentTime - startTime);
                
    //Convert to the (0.0f, 1.0f) scale.
    adjustedTime /= timeRange;
    
    //Calculate the current position in the easing function, after adjusting 'currentTime' to the range (0.0 - 1.0).
    float easePos = easeFunction(adjustedTime);
    
    //Get the range to convert the ease into.
    float distanceRange = (stopPos - startPos);
    
    //Calculate and return the result.
    return (distanceRange * easePos) + startPos;
}
Scaling ease output from (0.0 - 1.0) to whatever you desire.