FORUMS: list search recent posts

New to expressions: Add to value everytime question

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jason Hadley
New to expressions: Add to value everytime question
on Feb 16, 2012 at 7:47:46 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.


Return to posts index

Dan Ebberts
Re: New to expressions: Add to value everytime question
on Feb 16, 2012 at 9:01:53 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



Return to posts index

Jason Hadley
Re: New to expressions: Add to value everytime question
on Feb 16, 2012 at 9:19:55 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.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]