Instantly share code, notes, and snippets.

View ChangeSingleDimension.jsx
// Change Single Dimension - Created by Animoplex: www.animoplex.com
// Separate a property's values, change a single value, then combine them back together.
offset = thisComp.layer("Control").effect("Offset")("Slider");
x = value[0] + offset;
y = value[1];
[x, y]
View AddLightness.jsx
// Add Lightness - Created by Animoplex: www.animoplex.com
// Adds lightness percentage to a color value.
// Full Tutorial: https://www.youtube.com/watch?v=QkqiaPZJa1Y
// Lightness Example
moreLight = effect("Color Brightness")("Slider") / 100;
hsl = rgbToHsl(value);
assemble = [hsl[0], hsl[1], hsl[2] + moreLight, hsl[3]];
hslToRgb(assemble)
View RegularExpressions.jsx
// 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)
View SubstringExamples.jsx
// Substring Expressions - Created by Animoplex: www.animoplex.com
// Some advanced examples of substrings and text formatting combinations.
// Full Tutorial: https://www.youtube.com/watch?v=oz352OsNgnI
// Substring Examples
name.substr(0, 2) // Output everything between 0 and 2
name.substr(2, name.length) // Output everything between 2 and the last character
name.substr(name.length - 1, 1) // Output the last character
// Bonus Substring Example
View SourceText.jsx
// 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 + ")"
View RandomExpressions.jsx
// Random Expressions - Created by Animoplex: www.animoplex.com
// Generate random numbers between 0 and 1 with random, seedRandom, and gaussRandom methods.
// Full Tutorial: https://www.youtube.com/watch?v=MITA3ygqvQY
// Random Examples
random() // Returns a random number between 0 and 1 on every frame
random(5) // Returns a random number between 0 and 5 on every frame
random(-5, 5) // Returns a random number between -5 and 5 on every frame
// gaussRandom Examples
View ToFixedExpression.jsx
// Trim Decimals with toFixed() - Created by Animoplex: www.animoplex.com
// Trim to a specific number of decimal places and add zeros if the value is a whole number.
// Full Tutorial: https://www.youtube.com/watch?v=aIxnJBOhdBw
// Trim Decimals Example
value.toFixed(2) // Outputs a value of, for example, 1 as 1.00 and 1.667 as 1.66
// Text String Trim Decimals Example
parseInt(text.sourceText).toFixed(2) // Converts text to string and trims decimals
View MathMethods.jsx
// Math Methods - Created by Animoplex: www.animoplex.com
// Use these methods to manipulate properties and numerical values in After Effects.
// Full Tutorial: https://www.youtube.com/watch?v=aIxnJBOhdBw
// Math Method Examples
// Note: You must capitalize the M in Math for these methods to work properly.
Math.abs(-2) // Returns 2
Math.ceil(1.01) // Returns 2
Math.floor(1.99) // Returns 1
Math.min(1, 2, 3) // Returns 1
View LoopExpression.jsx
// Loop Expression - Created by Animoplex: www.animoplex.com
// Basic loop expressions for use on a property in After Effects.
// Full Tutorial: https://www.youtube.com/watch?v=XRrs9pvWGuY
// Loop Examples
loopOut("cycle", 0) // Repeat from start to finish. Default loop mode.
loopOut("pingpong", 2) // Loops last three keyframes back and forth.
loopOut("offset", 0) // Repeats animation using last keyframe as new start point.
loopOut("continue") // Does not loop, but continues onwards with current velocity.
View LinearEaseExpression.jsx
// 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)