AE弄了个模板,发现正计时和倒计时不统一,请高手看下,是表达式问题吗?

2024-11-28 01:34:07
推荐回答(1个)
回答1:

我试了一下,倒计时“秒”比正计时快了0.5s,在每秒的0.5s处倒计时就动了,这个问题不难看出来,并且这么计时肯定是有错误的,问题很好改,正计时没问题,倒计时问题出在了这句:seconds = Math.round(countdownerFrame / framebase)%60;你只要将:
Math.round(countdownerFrame / framebase)%60的Math.round改为Math.ceil就好,不让渗含它四舍五入,让它向上取值就好了。为了确保安全,你丛腔笑最好也把下面的minutes = Math.round(((countdownerFrame / framebase)/60-0.5)%60);
也改成ceil。
把下面我改好的复制粘上去行了。

倒计时:
framebase = 1.0/comp("Music Visualizator 05").frameDuration;
totalDuration = Math.round(comp("Music Visualizator 05").duration)*framebase;

frameAtTime = timeToFrames(t = time + comp("Music Visualizator 05").displayStartTime, fps = 1.0 / comp("Music Visualizator 05").frameDuration, isDuration = false);
countdownerFrame = totalDuration - frameAtTime;

seconds = Math.ceil(countdownerFrame / framebase)%60;
seconds < 10 ? secondsString = "0" + seconds : secondsString = "" + seconds;

minutes = Math.ceil(((countdownerFrame / framebase)/60-0.5)%60);
minutes < 10 ? minutesString = "0" + minutes : minutesString = "" + minutes;

timecodeDisplay = minutesString + ":"圆差 + secondsString;