-
Using the delta of Math.sin to make non-linear motion
Not sure if the title is clear so here goes :
I’m animating a snake like layer using Math.sin on the Corner Pin effect of this same layer. This means that the layer oscillates in a squeeze-stretch fashion, like an accordion, and this is great because I can use slider controls to modify amplitude and frequency at will.
What I would now like to do is to take the delta of the Math.sin function (with Math.abs?) and use that to move the layer over the Y axis in a non-linear way, meaning that as the snake squeezes it moves slower, and as it stretches back out it accelerates, until it reaches a certain point.
I’ve gone as far as feeding the delta value into a text layer, but for the life of me I cannot figure out how to have a variable of some sort increase over time using the Math.abs of the delta of the Math.sin (!!). Whatever I do the variable oscillates around it’s original value, instead of increasing steadily over time…
I’ve pasted my delta function below for reference (I’m working in 25fps hence the (time-0.04).
Any help will be greatly appreciated !
delta=Math.abs(thisComp.layer("controls").transform.xPosition-thisComp.layer("controls").transform.xPosition.valueAtTime(time-0.04))