ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Moving from one layer to another by control slider of index

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Brian Nishii
Moving from one layer to another by control slider of index
on Jan 3, 2018 at 8:34:08 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?


Return to posts index

Kalleheikki Kannisto
Re: Moving from one layer to another by control slider of index
on Jan 3, 2018 at 4:13:40 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]