Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Define Global Scale Range Using Markers

  • Define Global Scale Range Using Markers

    Posted by Mark Crenshaw on May 13, 2023 at 5:06 pm

    I have many follower layers in a chain that are entering frame along a 3D path, rotating around a 3D layer and then exiting the opposite side of the frame.

    Using this expression:

    strt = 0; //start time of template motion
    end = 25; //end time of template motion

    t = thisComp.layer(“template”);
    offset = (t.effect(“offset”)(“Slider”)/100)*(index -1);
    travel = linear(t.effect(“travel”)(“Slider”)/100,strt,end);
    t.position.valueAtTime(travel – offset)

    As they rotate around, I want them to scale slightly, then return to original scale as they pass behind the layer. Since each follower crosses the front of the 3D layer at a different time, key frames would be complicated and referencing in/out points doesn’t correct for timing.I was thinking using 2 markers on a control null would be able to do the following. As each follower moves along in time and encounters the first marker, it would scale as defined in a scale expression, then be back to it’s original scale as it encounters the second marker and continue on it’s path. Being able to move the markers to easily adjust the range for quick adjustments if the timing of the overall animation changes, would be ideal.

    I found this expression. Seems that if it could point to the markers instead of in/out points, it would work. I’m just not sure how to do it.

    t = time;
    tMin = thisLayer.inPoint;
    tMax = thisLayer.outPoint;
    sclVal = linear(t, tMin, tMax, 0, 50);
    [value[0] + sclVal, value[1] + sclVal]

    Thanks in advance.

    Brie Clayton replied 6 months, 3 weeks ago 4 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    May 13, 2023 at 7:33 pm

    I think something like this does what you’re describing, but it will affect each follower at the same time, so I don’t think it’s the solution you’re looking for.

    tScale = .2;
    m = thisComp.layer("control").marker;
    tMin = m.key(1).time;
    tMax = m.key(2).time;
    if (time < (tMin+tMax)/2)
    s = linear(time,tMin,tMin+tScale,0,50)
    s = linear(time,tMax,tMax+tScale,50,0);
    value + [s,s]
  • Filip Vandueren

    May 14, 2023 at 8:29 am

    If I understand the path you’re describing correctly, you could linear() their scale to the z-component of the position (or the distance from layer to camera if the camera isn’t in the default position/orientation). Then the layers get larger as they are closer to the camera, slightly exaggerating what perspective is already doing.

  • Dan Ebberts

    May 14, 2023 at 2:12 pm

    I guess you could combine it with the offset element from your first expression:

    t = thisComp.layer("template");
    offset = (t.effect("offset")("Slider")/100)*(index -1);
    tScale = .2;
    m = thisComp.layer("control").marker;
    tMin = m.key(1).time+offset;
    tMax = m.key(2).time+offset;
    if (time < (tMin+tMax)/2)
    s = linear(time,tMin,tMin+tScale,0,50)
    s = linear(time,tMax,tMax+tScale,50,0);
    value + [s,s]
  • Mark Crenshaw

    May 14, 2023 at 3:32 pm

    Thanks for this Dan! It works to scale up and then back down and adjusts with the markers as planne. I just need to figure out the balance between the offset on position and the offset on scale. Thanks for the time you put into this. Much appreciated!

  • Brie Clayton

    May 14, 2023 at 5:13 pm

    Thank you for the solve, Dan!

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