Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Using linear() with smooth() in the same expression

  • Using linear() with smooth() in the same expression

    Posted by David Kaminski on November 22, 2015 at 7:42 pm

    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

David Kaminski replied 10 years, 5 months ago 1 Member · 1 Reply
  • 1 Reply
    • David Kaminski

      November 23, 2015 at 1:19 am

      I continued experimenting and finally achieved what I wanted. I didn’t realize the third value of smooth() was time. Putting my offset in the smooth expression took care of everything. If someone happens to run into the same problem here’s what I did-

      offset = effect("Controller")("Offset");
      s = effect("Controller")("Smoothing");
      output = comp("Comp 1").layer("Setup").effect("Range 1")("Output 1").smooth(s,10,time + offset);
      min = effect("Controller")("Range Minimum");
      max = effect("Controller")("Range Maximum");
      linear(output,0,100,effect("Controller")("Min"),effect("Controller")("Max"));

      Dave

    We use anonymous cookies to give you the best experience we can.
    Our Privacy policy | GDPR Policy