Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Check percentage value range and play frame in layer script!

  • Check percentage value range and play frame in layer script!

    Posted by Dan Kim on May 29, 2020 at 8:22 am

    Hello all, I have close to zero knowledge of scripting so hopefully somebody here can help me with the correct syntax here.

    I am trying to use tracked eye blink data from a video and apply it to a blink animation.

    I have two layers. One layer has tracked eye blink data by percentage. I have converted the percentage to float number in a slider (I’m not using the slider for anything other than to convert the percent number to just a number)

    I have a second layer with three frames of eye blink animation. The animation layer is a precomp with eye closed on frame 1, eye midway open on frame 2, and eye fully open on frame 3.

    I’ve time remapped the precomped layer and added the following expression:

    if (effect(“Slider Control”)(“Slider”) > 0 || effect(“Slider Control”)(“Slider”) < 20)
    framesToTime(1)
    else if (effect(“Slider Control”)(“Slider”) > 21 || effect(“Slider Control”)(“Slider”) < 50)
    framesToTime(2)
    else framesToTime(3)

    My only goal is to have the precomped animation layer look at the tracked data and if the data is between 0-20 then show frame 1, else if the tracked data is between 21-50 then show frame 2, else show frame 3

    Hope this makes sense. I feel like I’m close but I can’t figure out the correct way to write the expression. Any help is greatly appreciated!

    if (effect("Slider Control")("Slider") > 0 || effect("Slider Control")("Slider") &lt; 20)
    framesToTime(1)
    else if (effect("Slider Control")("Slider") > 21 || effect("Slider Control")("Slider") &lt; 50)
    framesToTime(2)
    else framesToTime(3)

    Dan Kim replied 6 years, 2 months ago 1 Member · 1 Reply
  • 1 Reply
  • Dan Kim

    May 29, 2020 at 8:33 am

    …and as usual, I found the answer two seconds after asking on the forum. I just need the &&

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