Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions New to expressions: Add to value everytime question

  • New to expressions: Add to value everytime question

    Posted by Jason Hadley on February 16, 2012 at 7:47 pm

    I have a composition that has a checkbox control randomly turning on and off. I want to be able to control the color of a solid so that everytime the checkbox turns on, it adds a set number to a colorize hue attribute.

    So far I’ve figured out

    x = thisComp.layer("Controller").effect("Random On/Off")("Checkbox")

    if (x=1) {value+50}
    but everytime it turns off, it goes back to zero. Is there a way to keep adding 50 everytime it turns on?

    I’m guessing it’s very simple.

    Jason Hadley replied 14 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 16, 2012 at 9:01 pm

    Not so simple because expressions can’t pass information from frame to frame. Your expression needs to loop through all previous frames, using valueAtTime(), and count the times the checkbox goes from off to on, then multiply that by 50.

    Dan

  • Jason Hadley

    February 16, 2012 at 9:19 pm

    Thanks Dan. I didn’t know that they can’t pass information from frame to frame. I figured it’d be like pressing equals on a calculator over and over. I have a lot to learn.

    Appreciate you taking the time though.

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