Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression to Change Scale Value to 100 at the end of the Composition no Matter How Long

  • Expression to Change Scale Value to 100 at the end of the Composition no Matter How Long

    Posted by Matias Andersen on September 26, 2016 at 11:47 pm

    I didn’t know what to put in the title, but anyways.

    I’m currently working with progress bars, and the way i make them is with keyframes.
    1 at the start and 1 at the end, the problem is that i’m working on a template for a client, and i want it to be as simple as possible.

    So i don’t want my client to change the end keyframe every time he has to render it, i’m not too experienced with expressions yet so i have no idea.
    I would be fine with just having a slider where you put the length of the comp in seconds, and it will move the keyframe to that point in the comp.
    Or just change the scale value to 100 and that point in the comp, or something similar.

    If there’s no way to do such a thing, i might need to find a new way to create my progress bars.

    Matias Andersen replied 9 years, 10 months ago 2 Members · 9 Replies
  • 9 Replies
  • Dan Ebberts

    September 27, 2016 at 12:26 am

    Something like this will probably work:


    t = time;
    if (numKeys > 1){
    t1 = key(1).time;
    t2 = key(numKeys).time;
    t = linear(time,t1,thisComp.duration,t1,t2);
    }
    valueAtTime(t);

    Dan

  • Matias Andersen

    September 27, 2016 at 12:56 pm

    It might just be me who doens’t know how to you the expression correctly, but it doens’t seem to have any effect on either the scale or a slider control. The value of the slider controls stays at 0 no matter how long on the time line it is, same with the scale.

  • Dan Ebberts

    September 27, 2016 at 3:48 pm

    You need to put it on a property that has at least two keyframes.

    Dan

  • Matias Andersen

    September 27, 2016 at 9:03 pm

    Yes it works !

    Thanks alot Dan, i will save this expression for future use.

  • Matias Andersen

    September 27, 2016 at 9:48 pm

    Just 1 last question, is it possible to set it to the length of another composition ?

    I’m just curious.

  • Dan Ebberts

    September 27, 2016 at 9:51 pm

    With an expression? No, an expression can’t set the length of a composition.

    Dan

  • Matias Andersen

    September 28, 2016 at 12:11 am

    I meant like with the expression you gave earlier, can you make it apply to another composition ?

    Like let’s say i have a “main” composition and a “render” composition, and the progress bar is in the main comp.
    Can it apply to the render comp’s length instead of the main comp ?

    On another subject, can you make any expression that apply to another comp ?
    Like if you have a “Control” layer in “comp 1” and you want to for example
    link the color of a fill in “Comp 2” to a color control on the Control layer.

    Is that possible ?

    That is my last question before i move on in life.

  • Dan Ebberts

    September 28, 2016 at 12:29 am

    I think this is what you’re asking for:


    t = time;
    if (numKeys > 1){
    t1 = key(1).time;
    t2 = key(numKeys).time;
    t = linear(time,t1,comp("render").duration,t1,t2);
    }
    valueAtTime(t);

    >… can you make any expression that apply to another comp ?

    Sure, you’d have the expression on the Fill Color in Comp 2 and it would refer to the control in Comp 1.

    Dan

  • Matias Andersen

    September 28, 2016 at 2:46 am

    I see, thank you.

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