Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions a counter for exact value

Tagged: 

  • a counter for exact value

  • Kyaw Min

    June 13, 2021 at 3:47 am

    I want to make a counter for exact value

    e.g in midi slider (thisComp.layer(“midi”).effect(“ch_0_pitch”)(“Slider”))

    includes notes’ values such as 45, 62, 48,45,45,82,95,72,45

    I want to count only note value 45 when slider pass it’s keyframe and create it’s increment counter.

    BTW my AE crash when I use while loop. so, It’s difficult to test with while loop.

  • Filip Vandueren

    June 14, 2021 at 2:40 pm

    I suppose you only want to count it when a keyframe on the slider equals 45, not when the slider happens to interpolate across 45 (e.g. from 44 -> 46if they’re not hold keyframes).

    sl = thisComp.layer("midi").effect("ch_0_pitch")("Slider");
    count=0;
    for (i=1; i<=sl.numKeys; i++) {
    if (sl.key(i).time>time) break
    if (sl.key(i).value==45) count++;
    }
    count

  • Kyaw Min

    June 14, 2021 at 4:28 pm

    Thanks Filip,

    That is all I need .

    TBH , I don’t know how to use brake and continue. This is why I was stuck.

    I can count. but when criteria doesn’t meet , it shows the numbers blank or zero.

    Just blink the count number when a keyframe on the slider equals 45.

    I want to show the count number all the time just like you.

    Now happily finish one part.

Viewing 1 - 3 of 3 posts

Log in to reply.

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