Skip to content

Instantly share code, notes, and snippets.

@tasinttttttt
Last active August 29, 2015 14:23
Show Gist options
  • Save tasinttttttt/320402c4482aaec67a6a to your computer and use it in GitHub Desktop.
Save tasinttttttt/320402c4482aaec67a6a to your computer and use it in GitHub Desktop.
AfterEffects scripts
rate = 1; // 2 = 2x speed
clockStart = 0; //negative for countdown
function padZero(n){ //utility
if (n < 10) return "0" + n else return "" + n
}
clockTime = clockStart + rate * (timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false) - inPoint); //inPoint means layer start.
if (clockTime < 0){ // negative sign for countdown
sign = "-";
clockTime = -clockTime;
}else{
sign = "";
}
t = Math.floor(clockTime);
hour = Math.floor((t%3600)/60);
min = Math.floor(t%60);
sign + padZero(hour) + ":" + padZero(min) // change separator sign between quotes
t = time;
fr = t/thisComp.frameDuration;
x = value [0];
s = 4; //Speed in pixels per frame
[x, fr*s]
/*
by Rick Gerard
as found in Adobe forums (https://forums.adobe.com/message/3471862)
Because of the interaction between frame rate and motion it's critical that your title roll move an whole number of pixels per frame.
IOW, 1 pixel per frame or 2 pixels per frame, and not 2.64 pixels per frame.
Interlaced video add must at an even number of pixels per frame.
This is easily accomplished with an expression. The [above] will give you speeds that will be smooth.
Any other speed will give you a stroboscopic effect where the titles appear to jerk around or thin edges will vary in height.
You may still experience some juddering if the display's refresh rate isn't the same as the frame rate.
Using this expression you can be sure that your credit roll with have accurately placed type.
There may still be issues with retinal retention frame rates and other factors at high scroll speeds
The solution there is to increase the frame rate of your title roll comp, render it, then time remap with frame blending
Perfect rolling titles at high speeds are not a walk in the park.
Rolling titles at a speed of up to about 4 pixels per frame are fairly straight forward*/.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment