I've just posted a little easing library on GitHub. It can be found here: https://github.com/guillaumerangheard/easing.bi.

It contains two classes. The first one (which is more of a type alias, really) is

*easing.equation*. It's basically a function that takes a

*double*and returns another

*double*. All the classics are here: circular, cubic, exponential, linear (of course), quadratic, quartic, quintic, sine and smooth(er)step easing. The second class,

*easing.curve*, emulates CSS's

*cubic-bezier*. It takes four numbers (as

*double*s) :

*x1*,

*y1*,

*x2*, and

*y2*, corresponding to the curve's second and third keypoints (as the other two are implicit). Once you've created your curve, just call its

*.compute*method (which takes a

*double*and returns a

*double*, and

*voilà*.

Any and all feedback, criticism, and/or suggestion is of course welcome.

I believe the code is self-explanatory, but here's a little example:

Code: Select all

```
#include "easing/easing.bi"
using easing
print !"easing.equation:\n"
for i as double => 0d to 10d
print i, cubicInOut(i / 10d)
next i
print !"\neasing.curve:\n"
dim as curve c => curve(0d, .42d, .58d, 1d)
for i as double => 0d to 10d
print i, c.compute(i / 10d)
next i
sleep
```