Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Controlling a Keyframe Value with Expressions

  • Controlling a Keyframe Value with Expressions

    Posted by George Henderson on November 2, 2023 at 5:03 pm

    Hi there

    I haven’t had much luck setting up the following action; could someone please explain how to achieve the following? <b style=”font-family: inherit; font-size: inherit; color: var(–bb-body-text-color);”>(A sample project is attached.)

    1. I have an object in my comp called ‘Square’ and a null layer called ‘Controller’ with a ‘Checkbox Control’ effect on it.
    2. The scale attribute on ‘Square’ has a keyframe on frame 20 with a value of ’50’ and a keyframe on frame 50 with a value of ‘100’. (A simple scale-up animation over a second (30fps)).
    3. When the checkbox is checked, I want the value of the second keyframe to be subtracted by 25. So, instead of going from 50 to 100, it’ll go 50 to 75.

    Any help would be greatly appreciated.

    Thank you!

    Brie Clayton replied 8 months, 2 weeks ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    November 2, 2023 at 5:12 pm

    Since your keyframes are linear, you could do something like this:

    sc=thisComp.layer("Controller").effect("Size")("Checkbox").value;
    sc ? linear(time,key(1).time,key(2).time,key(1).value,key(2).value - [25,25]) : value
  • George Henderson

    November 8, 2023 at 11:08 pm

    That did it; thank you so much, as always.

  • Brie Clayton

    November 8, 2023 at 11:09 pm

    Thank you for solving this, Dan!

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