-
Check percentage value range and play frame in layer script!
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") < 20)
framesToTime(1)
else if (effect("Slider Control")("Slider") > 21 || effect("Slider Control")("Slider") < 50)
framesToTime(2)
else framesToTime(3)