Copy link to clipboard
Copied
This is very similar to my previous question, however, now I would like to do the same thing but on a single value suich as 'amount' or 'frequency' or 'transparency' I would like to be able to write an expression that will translate a value between two numbers evenly. Wiggle won't work because wiggle is random. Instead, I want to write an expression that allows that single value to oscillate back and forth between two values at the same speed and frequency.
For example:
If my 'amount' in glow is set to 20, I would like it to move evenly between 20 and 30. Like someone turning a dimmer switch up and down at the same speed and fequency. I would generally need this expression for a multitude of 'single values' in different effects. When I say 'single value' I mean it is not an X or Y but something singular like how transparency just has one value.
Something like this should work:
minVal = 20;
maxVal = 30;
freq = 1; // oscillations per second
avgVal = (minVal + maxVal)/2;
amp = (maxVal - minVal)/2
avgVal + amp*(Math.sin(time*freq*Math.PI*2))
Dan
Copy link to clipboard
Copied
Something like this should work:
minVal = 20;
maxVal = 30;
freq = 1; // oscillations per second
avgVal = (minVal + maxVal)/2;
amp = (maxVal - minVal)/2
avgVal + amp*(Math.sin(time*freq*Math.PI*2))
Dan