Skip to content

Instantly share code, notes, and snippets.

@jackrugile
Created January 24, 2016 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackrugile/b0d834be736e711f5863 to your computer and use it in GitHub Desktop.
Save jackrugile/b0d834be736e711f5863 to your computer and use it in GitHub Desktop.
function onGLC(glc) {
glc.loop();
glc.size(400, 400);
glc.setDuration(2.5);
glc.setFPS(60);
glc.setMode('bounce');
glc.setEasing(false);
var list = glc.renderList,
width = glc.w,
height = glc.h,
color = glc.color;
glc.styles.backgroundColor = 'rgba(100, 30, 60, 1)';
glc.styles.blendMode = 'overlay';
function ease( t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
}
var container = list.addContainer({
x: width / 2,
y: height / 2,
phase: 1,
speedMult: 0.5,
rotation: function( t ) {
var val = ease( t * 4, 0, 1, 1 );
return val * 270;
}
});
var grid = 5;
for( var x = 0; x < grid; x++ ) {
for( var y = 0; y < grid; y++ ) {
list.addCircle({
x: width / grid * x + width / grid / 2 - width / 2,
y: height / grid * y + height / grid / 2 - height / 2,
radius: function( t ) {
var val = ease( t, 0, 1, 1 );
return 2 + val * 78;
},
fillStyle: function( t ) {
t += x / 0.5;
var val = ease( t, 0, 1, 1 );
return 'hsla(' + ( this.x - this.y ) / 4 + ', 80%, 85%, ' + (0.1 + val * 0.9) + ')';
},
shadowColor: [ '#fff', '#f66' ],
shadowBlur: [ 4, 60 ],
fill: true,
lineWidth: [ 1, 0 ],
phase: x / grid * - 0.1 + y / grid * - 0.1,
parent: container
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment