Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Adding checkbox keyframes at determined times with a script

  • Adding checkbox keyframes at determined times with a script

    Posted by Nate Biehl on August 27, 2014 at 4:55 pm

    Hi everyone,

    I’m trying to animate on a series of masks to imitate a hardware LED light bar lighting up, like this:

    Right now I have 10 masks on a solid, with each mask’s opacity controlled by a check box in the layer and an if/then expression. The check box means the mask is either 100% on or 100% off. I have 10 checkbox controls on the layer, each one corresponding to a mask that creates an individual “light” in the LED bar.

    This solves the problem of animating it on and off light by light really well, but I’m going to need to animate it hundreds of times over the next few months for a lot of different light bars, each one individually indicating a level between 1 and 10.

    I would love to be able to run a script to get this done. Does anyone know of a way to do this? The ultimate script would have a way for me to input what number I need to indicate (or be able to call that number from a slider) and then add check box keyframes at 2 frame intervals to animate the “lights” on. So if I need 5 lights to light up on the bar to indicate the strength of an item, I put a slider at 5, run the script, and it sets keyframes for the first 5 checkboxes at 2 frame intervals. Is this reasonable?

    Here’s a project example of what I’m talking about.

    7911_animateon.aep.zip

    Motion Graphics Designer
    Warm Springs Productions
    Missoula, Montana

    Nate Biehl replied 11 years, 8 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    August 27, 2014 at 8:42 pm

    I think you could replace all the checkboxes with a single slider applied to each layer. Then all of the Mask Opacity expressions would be exactly the same:

    s = Math.round(effect(“Slider Control”)(“Slider”));
    n = thisProperty.propertyGroup(1).propertyIndex;
    (n <= s) ? 100 : 0

    You could certainly create a script UI to let you enter the numbers and then have it set the slider values for you, but it would be a bit of work if you’ve never done it before. Good project to learn scripting though.

    Dan

  • Nate Biehl

    August 28, 2014 at 3:40 pm

    Dan, this expression works great. Thank you. Any way you can break down how it works for me?

    Motion Graphics Designer
    Warm Springs Productions
    Missoula, Montana

  • Nate Biehl

    August 28, 2014 at 3:48 pm

    Actually, I think I got it.
    The round changes the input of the slider into whole numbers. When the slider amount gets to a number that’s greater than the index of the mask, it changes it’s opacity to 100. Until the, it stays at 0 percent opaque.

    Elegant solution. Thanks, Dan.

    Motion Graphics Designer
    Warm Springs Productions
    Missoula, Montana

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