Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Moving from one layer to another by control slider of index

  • Moving from one layer to another by control slider of index

    Posted by Brian Nishii on January 3, 2018 at 8:34 am

    I have a layer(“playhead”) that I want to move by “triggering” it with a control slider designating the layer index number to which I want it to move to.

    So my idea was to have the layer “playhead” look at the slider value of a control layer for an index number, and when it receives a new number (hold keyframed numbers on the control layer), then it would move from the current position to the new position of the designated index layer.

    I finally got the reading of the index layer right and the positioning is working, but I think I’m missing some more variables to make the transition happen.


    startPos=value;
    i=thisComp.layer("MASTER CONTROL").effect("Playhead Layer Index")("Slider").value;
    endPos=thisComp.layer(i).transform.position;

    linear(time,startPos,endPos)

    What do I need here?

    Kalleheikki Kannisto replied 8 years, 4 months ago 2 Members · 1 Reply
  • 1 Reply
  • Kalleheikki Kannisto

    January 3, 2018 at 4:13 pm

    You can’t do a linear transition because the value changes immediately. It simply jumps to the new position.

    To make a smooth transition you will need a loop that looks backwards x number of frames to see how much earlier the change occurred and calculate the motion based on that. Say, you want the transition in ten frames, you would loop back ten frames and if there was a change in value three frames back, you would know you are 3/10 (30%) along the transition between earlier position and new position.

    Kalleheikki Kannisto
    Senior Graphic Designer

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