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 / EnhancedYouTubeEmbed.html
Created March 24, 2019 19:26
Enhanced YouTube Embed Code - Animoplex
<!-- Enhanced Youtube Embed Code for Motion Portfolios - Created by Animoplex
Features: Responsive-width player, removes tracking cookies, changes red controls to white, reduces YouTube branding
How to use: Replace the standard YouTube iframe embed code with the code below and add your YouTube video ID -->
<div style="width:100%; max-width:960px;">
<div style="position:relative; height:0; padding-bottom:56.25%;">
<!-- Video size ratio calculation: 1080px / 1920px = 0.5625 (16:9) -->
<iframe
style="position:absolute; width:100%; height:100%;"
src="https://www.youtube-nocookie.com/embed/YOUTUBEVIDEO?autoplay=1&amp;color=white&amp;modestbranding=1&amp;rel=0"
@animoplex
animoplex / LoopWithMarkers.jsx
Created March 7, 2019 21:23
Loop Animation With Markers - After Effects Expression by Animoplex
// Loop Animation With Markers - Created by Animoplex: www.animoplex.com
// Repeat a property's keyframed animation, resetting the loop at the start of every layer marker
// Based loosely on Marker Sync Expression: http://www.motionscript.com/design-guide/marker-sync.html
n = 0;
if (marker.numKeys > 0) {
n = marker.nearestKey(time).index;
if (marker.key(n).time > time) {
n--;
} // get previous marker index
@animoplex
animoplex / Loops.jsx
Created March 6, 2019 06:49
Loop Expressions
// Loop Expressions
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
// loopOut evaluates from the first keyframe towards the layer outPoint
// loopIn can be substituted to evaluate from layer inPoint towards last keyframe
@animoplex
animoplex / LinearCounterbalance.jsx
Created March 6, 2019 05:09
Linear Counterbalance
// Linear Counterbalance
s = thisComp.layer("Control").effect("Slider Control")("Slider");
a = transform.position;
b = thisComp.layer("Null").toWorld([0,0,0]);
linear(s, 0, 100, a, b)
// Adjust a Slider Control (from 0 to 100) to balance between two values (a and b)
@animoplex
animoplex / LinearEase.jsx
Last active March 14, 2019 01:09
Linear & Ease Expressions
// Linear & Ease Expressions
linear(time, outPoint - 2, outPoint, 100, 0)
ease(transform.opacity, 0, 100, 25, 75)
// Linear fade from 100 to 0 for the last 2 seconds of a layer’s duration
// Ease from 25 to 75 as the Opacity input animates from 0 to 100
@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 / Value.jsx
Created March 6, 2019 02:27
Value Expression
// Value Expression
value / 2
// Current property value divided by 2
@animoplex
animoplex / PosterizeTime.jsx
Created March 5, 2019 15:42
Posterize Time
// Posterize Time
posterizeTime(12); value
// Interpolates property at 12 fps regardless of composition frame rate
@animoplex
animoplex / Time.jsx
Created March 5, 2019 15:39
Time Expression
// Time Expression
time * 10
// Output increases by 10 every second