Skip to content

Instantly share code, notes, and snippets.

View ryanbru0803's full-sized avatar

Ryan David ryanbru0803

  • Bogotá, Colombia
View GitHub Profile
@ryanbru0803
ryanbru0803 / time-wiggle.js
Created February 1, 2017 14:23
Start or stop wiggle at specific time
//Apply the following expression to a property to wiggle it beginning at time 2 seconds:
timeToStart = 2;
if (time > timeToStart){
wiggle(3,25);
}else{
value;
}
//Apply the following expression to a property to stop wiggling it at time 4 seconds:
timeToStop = 4;
@ryanbru0803
ryanbru0803 / random-wiggle.js
Created January 22, 2017 16:16
Random Wiggle
wiggle(4, random(-15,15));
@ryanbru0803
ryanbru0803 / ease-scale.js
Last active January 21, 2017 19:48
Ease Scale
//Zoom in
ease(time, inPoint, outPoint ,[100,100], [130,130]);
//Zoom out
ease(time, inPoint, outPoint,[130,130], [100,100]);
@ryanbru0803
ryanbru0803 / uniform-scale-wiggle.js
Last active March 7, 2018 02:38
Uniform Scale Wiggle
w = wiggle(2,10);
[w[0],w[0]]
@ryanbru0803
ryanbru0803 / wiggle-independently.js
Created December 25, 2016 14:31
Wiggle the X and Y values independently.
temp = wiggle(2,50);
x = temp[0];
y = value[1];
[x,y]
@ryanbru0803
ryanbru0803 / confetti.js
Last active March 7, 2018 02:40
Here's a little expression-based particle system that should work fine for confetti. Each layer becomes a "particle" that gets reused when its life expires. Create a small solid layer (say 15x15). Make it 3D. Apply a point control to the layer. Add t
/*Here's a little expression-based particle system that should work fine for confetti.
Each layer becomes a "particle" that gets reused when its life expires.
Create a small solid layer (say 15x15). Make it 3D.
Apply a point control to the layer.
Add this expression to the point control.
Adjust minSpeed, maxSpeed, maxDrift, and the two rotation parameters (m) to suit your needs.
If you decrease minSpeed, you may have to increase the "life" parameter of the point control or the particles may disappear as they reach the bottom of the page.
Duplicate this layer until you have enough particles (50 to 100 maybe?). */
life = 1.2; //life of particle
@ryanbru0803
ryanbru0803 / random-lines.js
Last active March 7, 2018 02:41
This expression will move a vertical bar back and forth across the screen randomly. Create a thin, rectangular solid. Apply the following expression to the position property. tMin and tMax are the minimum and maximum time it takes for the line to mak
/* This expression will move a vertical bar back and forth across the screen randomly.
Create a thin, rectangular solid. Apply the following expression to the position property.
tMin and tMax are the minimum and maximum time it takes for the line to make one movement.
Adjust them to your needs.
Duplicate the solid a bunch of times to generate a lot of motion. */
tMin = .5; //minimum segment duration
tMax = 2; //maximum segment duration
end = 0;
@ryanbru0803
ryanbru0803 / constant-rotation.js
Created December 24, 2016 13:46
Constant Rotation Per Second. No key frames needed to make a simple 360 rotation.
veloc = 360; //360 Degree Rotation per Second
r = rotation + (time - inPoint) *veloc;
[r]
@ryanbru0803
ryanbru0803 / squash-and-stretch.js
Last active February 26, 2020 08:46
The squash and stretch expression should make your animation a bit more alive by adding a proportional squash and stretch scale to your shapes or images.
maxDev = 13; // max deviation in pixels
spd = 30; //speed of oscillation
decay = 1.0; //how fast it slows down
t = time - inPoint;
x = scale[0] + maxDev*Math.sin(spd*t)/Math.exp(decay*t);
y = scale[0]*scale[1]/x;
[x,y]
@ryanbru0803
ryanbru0803 / ease-position.js
Last active January 22, 2017 16:10
In After Effects, add this code to the position property to ease an object right, left, up, or down.
//Right
x = position[0];
y = position[1];
d = 262; //Distance in pixels
ease(time, 3, 4, [x , y], [x+d , y]);
//Left
x = position[0];
y = position[1];
d = 262;