# Interpolate between presets

Hello,
I have a set of integers in a table that I’m using as animation presets. When I switch the preset value from, say, -90 to 90, I need to interpolate between the two so it’s a smooth and steady change.

First, it needs a slight ease in and out. Second, there needs to be a maximum speed for the change. The goal is to match the movement of a motor that automatically smooths it’s movements and has a max RPM of 6.8.

A filter chop could take care of the ease in and out, but I cannot find a good solution for the max speed. I tried a lag chop setting the “clamp acceleration”, but it produced some odd results… It also won’t let me ease in, only ease out.

I’ve attached a tox file with an example of what I’m after.

Thanks!
interpolation.tox (1.82 KB)

hmm not sure what’s going on there… but if you want to limit the motor speed, you just need to limit the slope (velocity).

I made a little test with a timer CHOP to find the right number, and it looks to be working.

6.8 rpm = 6.8 * 360 =2448 degrees per minute, or 40.8 degrees per second.

Which means a 90 degree turn should take 90/40.8 = ~2.2058 seconds.

Attached a timer chop which is set to that time, and the lag chop takes that time, to reach 90.
I’ve also attached a Slope CHOP which can measure the Velicity (slope) and it will shows a perfect 40.8 (which is degrees per second in your case).
Hope this helps!
max_degrees_per_second.tox (2.69 KB)

This works wonderfully, thanks! As for the ease in - why isn’t the lag chop smoothing the initial attack? It eases out, but the in is still linear. I always thought lag smoothed both…
Thanks again!