Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions increase number by one

  • increase number by one

    Posted by Anders Hattne on February 1, 2012 at 5:09 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?

    http://www.ardillamedia.com

    Anders Hattne replied 14 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 1, 2012 at 5:31 pm

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

    https://www.motionscript.com/design-guide/audio-count.html

    Dan

  • Anders Hattne

    February 1, 2012 at 6:21 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”

    http://www.ardillamedia.com

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