genartlib
genartlib copied to clipboard
Interpolate exp tanh
Ok so i'm just making cool stuff for my own art projects. And I'd like to share this with you!
I've extended algebra/interpolate
to accept some curve coefficients as optional arg.
Besides linear interpolation, there's also exponential, tanh and s-curve interpolation.
You can supply a curve to your interpolation like this:
(algebra/interpolate {:exponent 2} 0 1 0.5) ~= 0.4667
(algebra/interpolate {:tanh-factor -0.5} 0 1 0.5) ~= 0.755
I've added tests for clarity...
@thobbs I hope you have time to review this. I'd say this is a nice addition to your great lib!
@thobbs if you don't fancy me opening PR's, please let me know. That's ok. Greetings from The Netherlands. Keep up the great work!