Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to freeze an expression at a specific time

  • Kalleheikki Kannisto

    August 22, 2018 at 11:16 am

    Add a “value +” at the beginning of the last line of the expression. In that way the manual value of the property is added to the expression, frozen or not. (You may need to change the original value of the property for this to work as expected.)

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Francesco Bona

    August 22, 2018 at 12:15 pm

    Thanks but I can’t reposition the object manualy. The expression is made specifically to link the second object to the bottom margin of the first object. And the firts object is wiggled or moved by other expressions. So as I said it is impossible to manually reset the position to the right place.

    If you want to test or study my specific situation you need just to:

    – create 2 shapes
    – put a “heavy” wiggle expression to position and scale of the first object
    – put this expression to the position of the second object
    stop = 250;
    t = Math.min(time,framesToTime(stop));
    a=thisComp.layer("01"); // Key object
    d=30; // Distance
    s=a.transform.scale.valueAtTime(t)[1];
    apos=a.transform.position.valueAtTime(t)[1];
    ah=a.sourceRectAtTime(t).height/2;
    s1=transform.scale.valueAtTime(t)[1];
    h=thisLayer.sourceRectAtTime(t).height/2;

    [value[0] , apos+(ah*s/100)+(h*s1/100)+d]

    As you can see at frame 250 the second object stops exactly in the position it was at that frame – and this is ok – but now you can’t move the y position anymore cause it’s locked. And if you change the scale it changes as if its upper margin and position where locked.

    So… the problem remains the same: to obtain an object that, after frame 250 is unlinked from the expression, still in the exact position that it had under the control of the expression at frame 50, but free to be moved.

    I understand this case this case is becoming a mess and it’s my fault.. But seriously, I did not imagine it could be such a complicated thing..
    I really don’t know how to solve this problem

  • Francesco Bona

    August 22, 2018 at 1:29 pm

    Now that I’m really late I’ll proceed with a workaround that I’d rather not use: baking the second object position and keeping just the keyframe at frame 250 that is my stop. The result is exacty what I was trying to get directly into the expression but it makes my composition very chaotic. Infact here I’m talking about 2 objects but in reality I’m workin on more than 20 layers.
    In any case, I would like very much to find out how to solve with an expression.

  • Francesco Bona

    August 24, 2018 at 9:11 am

    Hi guys, could you just tell me if there’s not a solution because of my chaotic explanation or just because this operation must be done without expressions? I’m sorry but I’m really in trouble. I don’t want to bother you, I’m just trying to find – at least – a path to the solution.

    Thank you

  • Kalleheikki Kannisto

    August 24, 2018 at 10:02 am

    You can use value-valueAtTime(0)+[value[0] , apos+(ah*s/100)+(h*s1/100)+d] as your last line. That way the original position value will not affect the position and it ends up being exactly in the same place — as long as you don’t move the 2nd object during those first 250 frames.

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Francesco Bona

    August 24, 2018 at 11:52 pm

    I really thank you but it’s clear that I’m not getting through.
    The expression still doesn’t allow me after frame 250 to move the object on the y axis and as I said the scale property still fells the restriction of the bottom margin of the firt object.

    I definitely need a simpler case to understand each other so forget my “bottom margin link” expression. Really. I think the best possible example which sums up my needs is “unparent a child layer from the parent at a specific time”.

    Yes my needs are substantially similar to a “layers parenting” because when a layer is parented to another it follows its movements and changes butthis is the thing – if you unparent the child from the parent, the child keeps is own actual state.
    It doesen’t return to its native state and even if it’s free to be moved or changed its new “0 state” or “native state” has become that in which the last parenting instant has left it.

    This is exacty what I’m tryng to acheave. I have a more complicated situation than this but the gist is the same so I repeat: forget about my previus expression. What I’m asking to you all is this:
    How can I write an expression to unparent a child layer from its parent – for example – at frame 250?
    Once again, thank you all for your patience..

  • Kalleheikki Kannisto

    August 25, 2018 at 11:06 am

    The usual way to handle the unparenting is to split the child layer at that point and then unparent the copy while the current time indicator is at the split point, which retains the child transformations at that point in time.

    The expression method is to allow the manual value to be added to the expression value and then disable the expression at a given time. This means you can’t have keyframed changed before the “release” time.

    To me it seems like your question has been answered but your project is probably more complicated than the situation you’re describing if you’re not getting the expected result. Can you upload a project file that just has two layers with all the expressions and keyframes you currently have? Then we could see what the problem that you’re encountering really is.

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Francesco Bona

    September 2, 2018 at 5:19 pm

    I’m sorry I waited so long to answer but I wanted to study deeply your suggestions. Finally I understood that I was wrong and you were right! I thought the expression did not work because I was trying to move layer “B” with my mouse and not with keyframes! With keyframes everything works perfectly !!
    So.. Thank you all again. Thanks to you I’m making huge steps forward … Regarding my project: I have uploaded a very simplified scene of my current situation.
    12685_creativecow01.aep.zip
    As you will notice the expression applied to the second object is now a bit different – but congruent to your suggestions – because I wanted to be able to change the anchor points without changing the result.
    I also wanted to use a marker as a stop frame.

    D=30;
    Stop = thisLayer.marker.key(1).time;
    Duration=Math.min(time,Stop);
    A=thisComp.layer("A");
    AS=A.transform.scale.valueAtTime(Duration)[1];
    AY=A.transform.position.valueAtTime(Duration)[1];
    AH=A.sourceRectAtTime(Duration).height/2;

    AAncorY=thisComp.layer("A").transform.anchorPoint[1];
    ThisAncorY=transform.anchorPoint[1];

    ThisS=transform.scale.valueAtTime(Duration)[1];
    ThisH=thisLayer.sourceRectAtTime(Duration).height/2;

    value-valueAtTime(0)+[value[0] , AY+((AH-AAncorY)*AS/100)+((ThisH+ThisAncorY)*ThisS/100)+D]

    Thanks again!

Page 2 of 2

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