Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Call the value of a prop. at time of another prop. keyframe

  • Call the value of a prop. at time of another prop. keyframe

    Posted by Diego Villarino on November 25, 2024 at 2:12 pm

    Hi everyone! New to the forum. Let see if I can explain myself in order to get some helpfull hint!

     

    I want to automate the animation for a lower third box looking at the width of the text layer above.

    I have the rectangle width linked to the width of the text layer (that has a typewritting effect driven by a slider). I need to add extra margin to de width of the box. So in order to get a proper animation for the box I would love to use a linear expression to start from 0 (ignoring the margin and the default text width given by the blinking cursor) to the defined width by the text layer plus the margin.

     

    I think my problem is that the text layer width doesnt have keyframes and I dont want to use a specific time. So, is anyway of referencing the value of a prop. at the time of another prop. keyframe? Is this too tangled and I am missing a much easier approach? Thanks in advance!

    This is my incomplete expression for the rectangle size:

     

    t = thisComp.layer(index-1); // txt layer above

    w = t.sourceRectAtTime().width;

    m = effect(“Slider Control”)(1); // flexible extra margin

    an = w + m;

    x = linear(an, ?, ?, 0, an); // no clue of what I am doing here 🙁

    [x, value[1]]

     

    Best,

    Diego

    Diego Villarino replied 2 weeks ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    November 25, 2024 at 2:52 pm

    I’m not sure this is what you’re after, but it might help. If your text gets generated without keyframes, maybe you could get your timing info from a layer marker on your text layer that that you set where the text is done animating. Then you could do something like this:

    L = thisComp.layer(index-1);
    t = L.marker.key(1).time;
    w = L.sourceRectAtTime(t).width;
    m = effect("Slider Control")(1);
    an = w + m;
    x = linear(time,0,t,0,an);
    [x,value[1]]
  • Diego Villarino

    November 28, 2024 at 10:19 am

    Thank you Dan,

    I was trying to avoid any extra complication in order to automate the project for any kind of user. So the plan was to automate the info linked to the comp name and having only two kf for the whole animation. Anyway your response gave me the perfect hint and I ended up with this expression that seems to do the job (at the end I used a slider to control the box width, that is why I used one dimension):

    L = thisComp.layer(index-1);
    t1 = L.effect(1)(1).key(1).time;
    t2 = L.effect(1)(1).key(2).time;
    w = L.sourceRectAtTime(t2).width;
    m = effect(“Margin”)(1);
    an = w + m;
    linear(time,t1,t2,0,an);

    Best,

    Diego

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