Instantly share code, notes, and snippets.

🎯
Animating!

Animoplex animoplex

View GitHub Profile
@animoplex
animoplex / AdvancedWiggleExample.jsx
Created Dec 25, 2018
Advanced Wiggle Example - After Effects Expression by Animoplex
View AdvancedWiggleExample.jsx
// Advanced Wiggle Example - Created by Animoplex: www.animoplex.com
// The full expression from Lesson 507 which builds an advanced wiggle expression using a pseudo effect.
// Full Tutorial: https://www.youtube.com/watch?v=b4AAkT2Xuio&t=17s
src = effect("Wiggle Control");
tog = src("Toggle");
if (tog == true) {
freq = src("Frequency");
amp = src("Amplitude");
val = wiggle(freq, amp);
@animoplex
animoplex / WhileLoopExample.jsx
Created Dec 25, 2018
While Loop Example - After Effects Expression by Animoplex
View WhileLoopExample.jsx
// JavaScript While Loop Example - Created by Animoplex: www.animoplex.com
// The JavaScript While Loop and how it can be used in After Effects.
// Full Tutorial: https://www.youtube.com/watch?v=SG3NyHmfc0s&t=225s
src = thisComp.layer("Control").effect("Acceleration")("Slider");
dur = thisComp.frameDuration;
dist = 0;
t = 0;
while (t < time) {
dist += src.valueAtTime(t) * dur;
@animoplex
animoplex / ForLoopExample.jsx
Created Dec 25, 2018
For Loop Example - After Effects Expression by Animoplex
View ForLoopExample.jsx
// JavaScript For Loop Example - Created by Animoplex: www.animoplex.com
// The JavaScript For Loop and how it can be used in After Effects.
// Full Tutorial: https://www.youtube.com/watch?v=SG3NyHmfc0s&t=91s
myArray = [];
for (i = 0; i < thisComp.numLayers; i++) {
myArray[i] = thisComp.layer(i+1).name;
}
myArray.slice(0, thisComp.numLayers).join("\r")
@animoplex
animoplex / JavaScriptOperatorExamples.jsx
Created Dec 25, 2018
JavaScript Operator Examples - After Effects Expression by Animoplex
View JavaScriptOperatorExamples.jsx
// JavaScript Operator Examples - Created by Animoplex: www.animoplex.com
// The different operators in JavaScript and their outputs.
// Full Tutorial: https://www.youtube.com/watch?v=ppCF7jS1nAs&t=18s
1 < 2 // true
1 > 2 // false
1 <= 2 // true
1 >= 2 // false
1 == 2 // false
1 != 2 // true
@animoplex
animoplex / UniversalExpressionSyntax.jsx
Created Dec 22, 2018
Universal Expression Syntax - After Effects Expression by Animoplex
View UniversalExpressionSyntax.jsx
// Universal Expression Syntax - Created by Animoplex: www.animoplex.com
// The different types of expression syntax in After Effects and how to make them compatible in any language.
// Full Tutorial: https://www.youtube.com/watch?v=b1MxtywoqHg&t=192s
// Default Compact Expression:
effect("Fill")("Color")
// Basic Universal Expression (Property Index):
// Replace the effect property’s name with the property’s index.
// Give the effect object a custom name to avoid any localization errors.
@animoplex
animoplex / AfterEffectsNumberMethods.jsx
Created Dec 22, 2018
After Effects Number Methods - After Effects Expression by Animoplex
View AfterEffectsNumberMethods.jsx
// After Effects Number Methods - Created by Animoplex: www.animoplex.com
// List of compatible number methods in After Effects expressions and what they do.
// Full Tutorial: https://www.youtube.com/watch?v=l7Xd8mkqWfc&t=268s
// Outputs 10 as an integer, converting it from a string.
Number("10")
// Outputs 1 as an integer, the first valid number in the string. It ignores the second integer
parseInt("Layer 1 Copy 2")
@animoplex
animoplex / SimpleTriggerFade.jsx
Created Dec 22, 2018
Simple Trigger Fade - After Effects Expression by Animoplex
View SimpleTriggerFade.jsx
// 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 Dec 22, 2018
Linear Blend - After Effects Expression by Animoplex
View LinearBlend.jsx
// 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 Dec 22, 2018
Parent Attribute - After Effects Expression by Animoplex
View ParentAttribute.jsx
// 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 Sep 7, 2018
Change Single Dimension - After Effects Expression by Animoplex
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]