FORUMS: list search recent posts

increase number by one

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Anders Hattne
increase number by one
on Feb 1, 2012 at 5:09:44 pm

Hello there, I'm in a rush and can't find anything in fast enough searching.
We are doing this vocal sync animation with the puppet tool, triggered with audio to keyframes. It's a comp of the mouth opening time remapped so it jibbers to the sound.
To get some variation I thought I'll put a second layer on top where the opacity would alternate every time the value hits 0.
This is the expression so far... in the opacity

a =0;
input=comp("03_cap v2").layer("Light Gray Solid 3").effect("Sound Keys")("Output 1");
soundk=linear(input, 3, 12, 0 , 100);
if (soundk == 0) {a ++};
if (a % 2 ==0) {100}
else 0

I was hoping the value a would increase and that way every other time the upper layer would be visible. But I assume the a++ doesn't work as the value of a is set to 0 every time the expression is run.

Would there be a better way to do this?

Return to posts index

Dan Ebberts
Re: increase number by one
on Feb 1, 2012 at 5:31:54 pm

Expression variables don't persist from one frame to the next. You could rework my beat counter to use your soundkeys output:


Return to posts index

Anders Hattne
Re: increase number by one
on Feb 1, 2012 at 6:21:19 pm

Yes, I had a look at that one but figured I didn't get any of that. Learned helplessness..
when you mentioned it I figured I don't need to understand it and just added

if (n % 2 ==0) {100}
else 0

to the end. And that did the trick. Hopefully I get around to understand the beat counter later.

Many thanks"

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved