-
Using linear() with smooth() in the same expression
I am using sampleImage to output a value that I am applying to different parameters throughout my project. I am in the process of creating a master controller (“Controller”) which needs to have the following abilities:
- Slider for changing the min/max of the sampleImage output using linear()
- Slider for adjusting the smoothness using smooth()
- Slider for offsetting the time
I have achieved exactly what I want by creating three output sliders and chaining them together so:
sampleImage Output //Outputs a number 0-1
↓
Min/Max Output //Converts 0-1 to a min max of my choosing based on two sliders
output = comp("Comp 1").layer("Setup").effect("Range 1")("Output 1");↓
min = effect("Controller")("Range Minimum");
max = effect("Controller")("Range Maximum");
value = linear(output,0,1,min,max);Smoothness Output //Smooths output based on a slider
s = effect("Controller")("Smoothing")↓
effect("Controller")("MinMax Output").smooth(s,10);Time Offset Output //Offsets the time of the outout based on a slider
offset = effect("Controller")("Time Offset")
t = time + offset;
effect("Controller)("Smooth Output").valueAtTime(t);
From there I just connect whatever parameter to the “Time Offset Output” and it’s operational. This is great, however it is very clunky for other people that use my project. I would really like to have this all contained in one expression, so on the controller there would only be one output to pickwhip to. I have searched and tried many different things, but my limited understanding of expressions has rendered all my attempts as failures. Any help is greatly appreciated.Dave