Smooth animation/interpolation

@anoniim,

If you are look for non-linear alternatives to the lerp() and map() Processing built-ins, these are sometimes discussed as “interpolation” but often – especially in animation – called “easing.”

Easing forms are often named after the function type of the curve that does the mapping, e.g. linear, quadratic, cubic, sinusoidal, et cetera. There is a good survey of implementing these in Java Processing (for your Kotlin project) in the recent writeup:

Easing Functions in Processing

The source code from that writeup is here – it implements map2() and map3():

Several past Processing libraries have implemented a collection of easing function that might be worth looking over. Two in particular:

  1. gicentre utils, which includes Ease
  2. the Ani animation library, which is actually an older Processing 2 library from 2015, but implements easing as a full set of classes rather than mapping functions:

Finally, piecewise interpolation (a.k.a. list-based interpolation) is the same thing based on a segmented path rather than a curve.

4 Likes