language: C++ 4.7.2 (gcc-4.7.2)
date: 77 days 22 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
22
23
24
25
//"This can replace most of your basic linear interpolations - it's not extreme, but adds some nice smoothness to otherwise plain animation."
//>>> "This is your go-to interpolation function"
//From here: http://sol.gfxile.net/interpolation/
inline float SmoothStep(float position)
{
    return (position * position * (3.0f - (2.0f * position)));
}
 
 
//"One rather handy algorithm, especially when you don't necessarily know how the target will behave in the future
//(such as a camera tracking the player's character), is to apply weighted average to the value."
//From here: http://sol.gfxile.net/interpolation/
//
//The movement starts off fast, and rapidly decelerates as you approach the goal.
//Technically, you never actually reach 1.0f. The higher 'slowdown' is, the slower you approach the goal.
inline float WeightedAverage(float position, float slowdown = 15.0f)
{
    return ((position * (slowdown - 1.0f)) + 1.0f) / slowdown; 
}
 
//This doesn't actually effect the value at all.
inline float LinearEase(float position)
{
    return position;
}