JS smoothing functions for scalar value using interpolation curves (Composition by usefuldesign.au)
This JS code implements custom JS functions I wrote too mimic Quartz Composer's standard Smooth Patch inside JS patch execution.
The demo comp shows the results are identical to all the curves associated with the interpolation and smooth patches.
The motivation for writing was the annoying procrastination that the JS Smooth Array code that the Apple QC Visualiser Template employs. It's noticeable that the acceleration is proportional to it's distance from the current input value, resulting in sprites that seem repelled by their target co-ordinates when using that kind of expression. It's also not observant of a set period and is dependant on the input delta for it's slope, since it only carries the last frame value in state — nothing else.
I've also included files for Apples Grapher app which I used to determine the curve expressions (equations). Thanks to Yves Barois who help me to use Grapher's trickier functions (hello piecewise equations) despite Apples woefully scant documentation for that app.
Please credit code when used or used with alterations in your JS code and in your QC comp. Drop me an email too if you like!
usefuldesign [dot] au [at] gmail [dot] com
More like this