A tox asset used to create easing chops that can be sampled. This tool is basically just a wrapper of the amazing tools easings.net and ofxAnimatable. It can be used to ease chop driven animations which is especially useful when connected to triggers and timers.
To use the eases you need to:
- Create a
select CHOP
to choose the ease. In the path set it to expression mode and typeop.eases.op("NameOfTheEaseYouWant")
. You can find the name of all the eases by viewing the ease COMP. - You will need your tween value to be clamped between 0 and 1.
- Use a
lookup CHOP
with the tween and the ease.
You can either copy and paste the component into your touch file or use the released eases.tox
file available in ./release
or from the release page.
To add a new function, simply edit src/scripts/easesExt.py
and create the new function following the following syntax:
# function must start with capitalized "Ease"
def EaseFunctionName(self, x):
# ... logic here
return x # return a float
If you need a helper function do not expose it or prepend "Ease"
If you just need a simple custom cubic function you can make your own by using op.eases.CubicBezier()
. Create a setup as depicted below and edit the control points to the bezier through the 4 variables
The variables sent into the function are
CubicBezier(x, firstx, firsty, lastx, lasty, tx=1.0, ty=1.0)
"""
Implmentation taken from https://github.com/armadillu/ofxAnimatable
x: tween value
first[x,y]: first control points
last[x,y]: last control points
"""