Skip to content

Instantly share code, notes, and snippets.

View animoplex's full-sized avatar
🎯
Animating!

Animoplex animoplex

🎯
Animating!
View GitHub Profile
@animoplex
animoplex / PlayPauseCountdown.jsx
Created April 28, 2019 04:18
Play / Pause Realtime Countdown - After Effects Expression by Animoplex
// Play / Pause Realtime Countdown - Created by Animoplex: www.animoplex.com
// Counts down a clock in realtime with the ability to play and pause the countdown with a checkbox
// NOTE: Expression will gradually slow down over duration of comp due to the while loop mechanic
src = effect("Checkbox Control")("Checkbox"); // play/pause control
dur = thisComp.frameDuration; // length of 1 frame
count = 300; // 5 minutes in seconds
t = 0;
function addZero(n) { // adds a zero to the end of numbers 0-9
@animoplex
animoplex / ValueAtTime.jsx
Created March 6, 2019 02:42
Value At Time
// Value At Time
thisComp.layer(index - 1).transform.scale.valueAtTime(time - 2)
// Output Scale of layer above, delayed in time by 2 seconds
@animoplex
animoplex / LinearEaseExpression.jsx
Created September 4, 2018 01:52
Linear & Ease Expression - After Effects Expression by Animoplex
// Linear & Ease Expression - Created by Animoplex: www.animoplex.com
// Basic linear and ease expressions for use on a property in After Effects.
// Full Tutorial: https://www.youtube.com/watch?v=TFXgX0IiamQ
// Linear Example
linear(time - inPoint, 0, 100)
// Ease Example
ease(time - 5, 100, 0)
@animoplex
animoplex / SpeedVelocity.jsx
Last active June 29, 2020 17:19
Speed & Velocity - After Effects Expression by Animoplex
// Speed & Velocity - Created by Animoplex: www.animoplex.com
// A couple of examples of speed and velocity formatting.
// Full Tutorial: https://www.youtube.com/watch?v=47OWQmcez9M
// Speed
transform.position.speed
// Velocity
transform.position.velocity
@animoplex
animoplex / ChangePropertyFPS.jsx
Last active June 29, 2020 17:17
Change Property FPS - After Effects Expression by Animoplex
// Change Property FPS - Created by Animoplex: www.animoplex.com
// Gives you control of how keyframes per second are interpolated across two or more keyframes.
// Change the fps value on the first line to your desired FPS.
// Full Tutorial: https://www.youtube.com/watch?v=YLapbNyYxLs&t=257s
fps = 15;
posterizeTime(fps);
valueAtTime(time);
@animoplex
animoplex / RegularExpressions.jsx
Created September 5, 2018 00:07
Regular Expressions - After Effects Expression by Animoplex
// Regular Expressions - Created by Animoplex: www.animoplex.com
// Complex methods of searching and replacing text dynamically.
// Full Tutorial: https://www.youtube.com/watch?v=oz352OsNgnI
// Check out http://regexr.com/
// RegEx Examples
text.sourceText.replace(/one/gi,"1").replace(/two/gi,"2") // Replace "one" with "1" and "two" with "2"
text.sourceText.replace(/-/gi,"#") // Replace "-" with "#"
// Note: The /gi flags instruct the engine to search globally for text (g) and to be case insensitive (i)
@animoplex
animoplex / DashesCircleStroke.jsx
Last active June 29, 2020 17:17
Fixed Dashes Around Circle Stroke - After Effects Expression by Animoplex
// Fixed Dashes Around Circle Stroke - Created by Animoplex: www.animoplex.com
// Apply this to a Ellipse shape layer's Stroke Dash property.
// Full Tutorial: https://www.youtube.com/watch?v=I-Acdl_l9G0&t=562s
src = effect("Slider Control")("Slider");
rad = content("Ellipse").content("Ellipse Path").size[0] / 2;
gap = content("Ellipse").content("Stroke").dash.gap;
seg = src <= 0 ? 1 : src;
2 * Math.PI * rad / seg - gap
@animoplex
animoplex / AlternatingOutputs.jsx
Created February 28, 2019 15:03
Alternating Outputs - After Effects Expression by Animoplex
// Alternating Outputs - Created by Animoplex: www.animoplex.com
// Output changes between "Off" and "On" (or any output of your choice) every 10 frames
f = 10; // frame interval
int = framesToTime(f);
num = Math.floor( time / int );
if (( num % 2 ) == 0 ) {
"Off" // default output
} else {
"On" // alternate output
@animoplex
animoplex / TryCatchStatement.jsx
Last active June 29, 2020 17:17
Try Catch Statement - After Effects Expression by Animoplex
// Try Catch - Created by Animoplex: www.animoplex.com
// Checks to see if a property, effect, layer, comp, or object exists.
// Note: Works like if/then statement, except if the try fails, it does not break the expression.
// Full Tutorial: https://www.youtube.com/watch?v=SG3NyHmfc0s&t=475s
try {
thisComp.layer(index + 1).value;
} catch(err) {
1;
}
@animoplex
animoplex / SourceText.jsx
Created September 5, 2018 00:01
Source Text Expressions - After Effects Expression by Animoplex
// Source Text Expressions - Created by Animoplex: www.animoplex.com
// A few basic ways to manipulate and combine source text with other elements.
// Full Tutorial: https://www.youtube.com/watch?v=_XeV8NEtwjg
// Text Reference Example
comp("Template").layer("Title").text.sourceText
// Source Text + Values + Strings
"(" + text.sourceText + ")"