fork download
  1. //"This can replace most of your basic linear interpolations - it's not extreme, but adds some nice smoothness to otherwise plain animation."
  2. //>>> "This is your go-to interpolation function"
  3. //From here: http://s...content-available-to-author-only...e.net/interpolation/
  4. inline float SmoothStep(float position)
  5. {
  6. return (position * position * (3.0f - (2.0f * position)));
  7. }
  8.  
  9.  
  10. //"One rather handy algorithm, especially when you don't necessarily know how the target will behave in the future
  11. //(such as a camera tracking the player's character), is to apply weighted average to the value."
  12. //From here: http://s...content-available-to-author-only...e.net/interpolation/
  13. //
  14. //The movement starts off fast, and rapidly decelerates as you approach the goal.
  15. //Technically, you never actually reach 1.0f. The higher 'slowdown' is, the slower you approach the goal.
  16. inline float WeightedAverage(float position, float slowdown = 15.0f)
  17. {
  18. return ((position * (slowdown - 1.0f)) + 1.0f) / slowdown;
  19. }
  20.  
  21. //This doesn't actually effect the value at all.
  22. inline float LinearEase(float position)
  23. {
  24. return position;
  25. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty