-
Variable speed oscillator
Me again!
I have this delightful oscillation script I picked up somewhere and modified:
freq = thisComp.layer("H BPM #").effect("value")("Slider")/60; //oscillations per second
intensity = 5; // intensity
i = intensity*(1 + Math.sin(freq*time*Math.PI*2))/2;
[95+i,95+i]I’m applying it to the scale on a heart icon, and controlling it based on another expression controller which is animated for beats per minute.
it works perfectly when I don’t animate the BPM/frequency value. As soon as I animate that, some weird stuff starts happening. Speeds will go up and down in between keyframes. If the keyframes aren’t the first and last frames of the comp, the results will be reversed or just entirely wrong.
I suspect it has something to do with sine and how it works with time, but I am stuck…
Any ideas?