Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Can an expression link to another expression?

  • Can an expression link to another expression?

    Posted by Mario Rosales on January 10, 2013 at 12:14 am

    Thank you ahead of time

    I have searched and found little to no results to find if I can link one expression to another.

    i.e.,

    I have over 60 layers that I want to have an expression. However, instead of re-adjusting the expressoion one by one. I’m thinking crazy, maybe there’s a way to link one expression to another. So my end results is that I have 60 layers with expressions all pointing to one expression. So that the “Master” expression is adjusted, it affects all links.

    Here’s my expression;

    Vy0 = 500; //initial y velocity (pixels/second)
    Vx0 = 100; // initial x velocity (pixels/second)
    g = 2500; // gravity (pixels/second/second)
    floor = 400;
    e = .85; //elasticity
    b = floor – position[1];
    h = b + Vy0*Vy0/(2*g);
    T = Vy0/g + Math.sqrt(2*h/g);
    if ((time-inPoint) < T){
    y = Vy0*(time-inPoint) – g*(time-inPoint)*(time-inPoint)/2 + b;
    }else{
    Vy = -(Vy0 – g*T);
    while (true){
    Vy *= e;
    t = T;
    T += 2*Vy/g;
    if ((time-inPoint) < T){
    t = (time-inPoint) – t;
    y = Vy*t – g*t*t/2;
    break;
    }else if (T – t < thisComp.frameDuration){
    y = 0;
    break;
    }
    }
    }

    Cool very cool! I’m excited… Just cause

    Mario Rosales replied 13 years, 6 months ago 2 Members · 4 Replies
  • 4 Replies
  • Ridley Walker

    January 10, 2013 at 12:45 am

    A better approach is to use Expression Controls which are linked to the variable values in the expression.

    A simple example:

    A Null object with an Expression Control slider named “Offset”.

    Two layers with a position expression that reads:

    offset = thisComp.layer(“Control”).effect(“Offset”)(“Slider”);
    [transform.position[0],transform.position[1]+offset]

    Changing the value of the slider affects both layers.

    Here is an example: 5200_expressioncontrol.aep.zip

  • Mario Rosales

    January 10, 2013 at 1:14 am

    Goodness! Your so right, how could I had forgoten!

    Well I did do that and I was able to make several layers work, howeverw I got an error.

    Here’s my script

    Vy0 = thisComp.layer(“Null 1”).effect(“y Velocity”)(“Slider”); //initial y velocity (pixels/second)
    Vx0 = thisComp.layer(“Null 1”).effect(“x Velocity”)(“Slider”); // initial x velocity (pixels/second)
    g = thisComp.layer(“Null 1”).effect(“Gravity”)(“Slider”); // gravity (pixels/second/second)
    floor = thisComp.layer(“Null 1”).effect(“Floor”)(“Slider”);
    e = thisComp.layer(“Null 1”).effect(“Elasticity”)(“Slider”); //elasticity
    b = floor – position[1];
    h = b + Vy0*Vy0/(2*g);
    T = Vy0/g + Math.sqrt(2*h/g);
    if ((time-inPoint) < T){
    y = Vy0*(time-inPoint) – g*(time-inPoint)*(time-inPoint)/2 + b;
    }else{
    Vy = -(Vy0 – g*T);
    while (true){
    Vy *= e;
    t = T;
    T += 2*Vy/g;
    if ((time-inPoint) < T){
    t = (time-inPoint) – t;
    y = Vy*t – g*t*t/2;
    break;
    }else if (T – t < thisComp.frameDuration){
    y = 0;
    break;
    }
    }
    }


    I have the expression working on layers and comps. It also isn’t applied to certain Layers or Comps. Any light for this error?

    Cool very cool! I’m excited… Just cause

  • Ridley Walker

    January 10, 2013 at 1:50 am

    This is a divide by zero error, your slider has a value of 0 you need to account for that in the script so the value is never 0 and will not produce the error.

  • Mario Rosales

    January 15, 2013 at 10:44 pm

    THANK YOU!!! 🙂

    Cool very cool! I’m excited… Just cause

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