Skip to content

Instantly share code, notes, and snippets.

View animoplex's full-sized avatar
🎯
Animating!

Animoplex animoplex

🎯
Animating!
View GitHub Profile
@animoplex
animoplex / SimpleTriggerFade.jsx
Created December 22, 2018 00:59
Simple Trigger Fade - After Effects Expression by Animoplex
// Simple Trigger Fade - Created by Animoplex: www.animoplex.com
// Repeat a fade animation multiple times using markers to trigger the animation.
// Full Tutorial: https://www.youtube.com/watch?v=B_3XS2-VWOM
fadeFrames = 30; m = 0; t = time;
if (marker.numKeys > 0) {
m = marker.nearestKey(time).index;
tag = marker.key(m).comment;
if (tag == "In") { t = marker.key(m).time - time }
else if (tag == "Out") { t = time - marker.key(m).time }
@animoplex
animoplex / LinearBlend.jsx
Last active August 22, 2022 11:08
Linear Blend - After Effects Expression by Animoplex
// Linear Blend - Created by Animoplex: www.animoplex.com
// Blend between two expressions using a Slider and a linear method.
// Full Tutorial: https://www.youtube.com/watch?v=BOPfs49VfLE
src = thisComp.layer("Control").effect("Blend")("Slider");
a = transform.position;
b = thisComp.layer("Target").toWorld([0,0,0]);
linear(src, 0, 100, a, b)
@animoplex
animoplex / ParentAttribute.jsx
Created December 22, 2018 00:51
Parent Attribute - After Effects Expression by Animoplex
// Parent Attribute - Created by Animoplex: www.animoplex.com
// Checking for a parent with hasParent and matching the opacity with the parent attribute.
// Full Tutorial: https://www.youtube.com/watch?v=BOPfs49VfLE
if (hasParent == true) {
parent.transform.opacity
} else {
value
}
@animoplex
animoplex / ChangeSingleDimension.jsx
Created September 7, 2018 14:02
Change Single Dimension - After Effects Expression by Animoplex
// 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]
@animoplex
animoplex / AddLightness.jsx
Created September 5, 2018 14:15
Add Lightness - After Effects Expression by Animoplex
// 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)
@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 / SubstringExamples.jsx
Created September 5, 2018 00:01
Substring Examples - After Effects Expression by Animoplex
// 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
@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 + ")"
@animoplex
animoplex / RandomExpressions.jsx
Created September 4, 2018 02:27
Random Expressions - After Effects Expression by Animoplex
// 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
@animoplex
animoplex / ToFixedExpression.jsx
Created September 4, 2018 02:23
Trim Decimals - After Effects Expression by Animoplex
// 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