Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions control multiple positions with expression

  • control multiple positions with expression

    Posted by Adam Greenberg on April 4, 2018 at 2:53 pm

    HI everyone, I am trying to simplify something I’ve dealt with before, and because there is a logic to it, it must be something an expression can accomplish.

    See below for a link to a very simple ae project.

    I would like 4 positions to be controlled with sliders, the second and third position are held for a period of time before moving off screen. ( Position 1 is off screen and position 4 is off screen )

    In the example ( the white box ), in order to change the 2nd position, a user would need to select the exact 2 keyframes where the position is the same and move the position. They would have to repeat this process for the 3rd position by selecting 2 different keyframes and then moving those as well.

    I think this part alone can be solved with an expression with no keyframes at all, ( see the yellow solid ), but I only managed to figure out the first move, from the 11th keyframe to the 27th. After that, I only had errors when I tried to add to that expression.
    (see below)

    Also, the key frames from the white box are in easy ease in and easy ease out with the velocity adjusted to 90.
    This creates the look that the artistic director desires.

    So I was hoping that there was a way for the math.exp function to be included into the expression to help recreate that Bezier curve between all keyframes.

    So, in summary, is it possible to have an expression control multiple position keyframes from sliders, and secondly, is there a way to cheat the animation with the use of a math function to mimic the Bezier curve ?

    Thanks everyone

    ease(time,inPoint+11/29.97,inPoint+27/29.97,[2600.2,540],[effect("Slider Control")("Slider"),540]);

    Scott Mcgee replied 6 years, 1 month ago 2 Members · 3 Replies
  • 3 Replies
  • Scott Mcgee

    April 5, 2018 at 7:54 am

    There is probably a better way of doing this, which if you check out Dan Ebberts…There will be a for loop expression for this.

    but something like this would work if you are just using the 6 keyframes like you have in your project.

    All you are doing is telling it if you are between certain key frames to do something. Obviously then link your sliders to the bits you need to change, but I’ve just whipped this up quickly.

    t1 = key(1).time;
    t2 = key(2).time;
    t3 = key(3).time;
    t4 = key(4).time;
    t5 = key(5).time;
    t6 = key(6).time;

    pos1 = [thisComp.width, thisComp.height/2];
    pos2 = [thisComp.width/2, thisComp.height/2];
    pos4 = [thisComp.width/3, thisComp.height/2];
    pos5 = pos4;
    pos6 = pos1;

    if(time <= t2){
    } else if (time > t2 && time < t4){
    } else {

  • Adam Greenberg

    April 5, 2018 at 4:59 pm

    Thanks Scott, I’ll try it out,
    what is the purpose of this though ?
    thisComp.width, thisComp.height/2

    And also, any thoughts on the bezier curve of the 90 velocity ? I’m sure there must be a way.

    If not,
    I thought of a work around which would be to precomp the animation afterwards and time remap it frame by frame to mimic that movement. It may seem tedious but the user would never have to touch that precomp. It would be locked and hidden in the main comp. And it would work regardless of where the positions have been moved to.


  • Scott Mcgee

    April 6, 2018 at 7:51 am

    There is no purpose to this, I just use it to define a location. A lot of the time I want items to be directly central (thisComp.width/2, thisComp.height/2). You would just replace this with your x and y coordinates.

    Dan Ebberts wrote and expression that simulates exponential (bezier), you just need to fiddle with it a little bit, I could get it to work between the keyframes I wanted it to, but it kept breaking outside.

    decay = 3
    t = key(1).time;
    key(2).value + (key(1).value-key(2).value)/Math.exp(decay*(time-t));

    which you could look at incorporating

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