Copy link to clipboard
Copied
Dear experts, please help me...
I’m working on a 25fps project. There’s a main comp (~1 min) and a shorter comp (10 frames). The shorter comp is exactly 10 frames long. Each frame shows a different vector graphic number: frame 0 → number 0 … frame 9 → number 9.
This comp with the numbers is duplicated 3 times in the main comp: num_01, num_02, and num_03. I would like to control the numbers inside these comps using 3 sliders on the control_01 layer: sl_01, sl_02, and sl_03. For this, I enabled time remapping on the num comps.
I’m not an expert in scripting, but this is the simplest expression I found:
f = thisComp.layer("control_01").effect("sl_01")("Slider")
t = f * thisComp.frameDuration;
valueAtTime(t);It works…
until I try to set the slider to 6 or above. From 0–5 it shows the correct number, but 6 shows 5, 7 → 6, 8 → 7, 9 → 8, 10 → 9.
after 25 seconds, num_01 and num_02 change 1 frame earlier than the slider’s keyframes (while num_03 changes at the correct time).
I’m really trying to understand what’s happening. On top of that, I get different numbers after each render. I’m a noob, so it doesn’t make sense to me yet. Could you kindly explain what I’m missing?
(*The image is not mine, but similar to my project)
Copy link to clipboard
Copied
There may be some roundoff error creeping into the calculation. See if this works any better:
f = Math.round(thisComp.layer("control_01").effect("sl_01")("Slider"));
t = framesToTime(f);
valueAtTime(t);
Copy link to clipboard
Copied
Thank you for your time, dear Dan, unfortunately it doesn't make a difference.
In the meantime, I tried checking the values in the script. The f values seem correct (I’m not sure about the t values), but the main numbers still show differences at certain points in time.
Copy link to clipboard
Copied
Would it be possible for you to post a project file that demonstrates the issue?
Copy link to clipboard
Copied
I’m sending a reduced version of the project file. I tried to simplify it, but the problem should still be visible. I added notes into the markers showing which frames currently display incorrect values on my system. This doesn’t necessarily mean you’ll see the same frames, because on another pc the wrong values may appear at different time points.
Thank you very much for taking the time to look into this.
Copy link to clipboard
Copied
I'm kind of wandering out of my niche here, but instead of keyframing value changes on your sliders using 1-frame linear keyframe transitions, I'd suggest you try using hold keyframes for the new target values (and eliminate the keyframes that just duplicate the previous value). Does that make sense?
Copy link to clipboard
Copied
Yeah, I tried this yesterday as well, hoping it wouldn’t interpolate, but it still shows inexplicable nonsense on certain frames. 😞
Copy link to clipboard
Copied
Switching to hold keyframes and getting rid of the linear ones a frame before did work for me in the limited cases that I tried it. But you could also try, in addition to switching to hold keyframes, using this to harvest the slider values to make sure you get the value of the most recent keyframe:
f = thisComp.layer("control_01").effect("sl_05")("Slider").valueAtTime(time + thisComp.frameDuration/10);
Copy link to clipboard
Copied
Try removing valueAtTime and just output the f value as a frame# converted to time.
f=thisComp.layer("control_01").effect("sl_01")("Slider");
framesToTime(f);
Copy link to clipboard
Copied
Certain values still change too early, and it continues to produce random results.
Copy link to clipboard
Copied
okay so I have no idea why this worked or if it'll work for you, but I opened your project and after a bunch of troubleshooting I was able to get all the numbers working correctly by going into the Composition Settings for "numbers_10f" , and in the Advanced tab I enabled "Preserve frame rate when nested or in render queue" then purged all memory & cache. For some reason this fixed it on my end.
Copy link to clipboard
Copied
This is not a solution to the problem, so I’m still waiting for ideas…
I had to work around it, because the only accurate version is when I exclude time remap from the expression and simply display the variable’s value on a text layer.
Therefore, I was forced to create a custom font from my 10 vector layers, since the shapes are not too complicated.
BUT… if the task happened to involve more complex, image‑like shapes, this workaround would not work.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more