Skip to content

Instantly share code, notes, and snippets.

@phivk
Created March 8, 2016 19:05
Show Gist options
  • Save phivk/f9bb28b5f7a842724c98 to your computer and use it in GitHub Desktop.
Save phivk/f9bb28b5f7a842724c98 to your computer and use it in GitHub Desktop.
hypnotic stars in GifLoopCoder
function onGLC(glc) {
glc.loop();
glc.size(400, 400);
glc.setDuration(3.5);
glc.setFPS(30);
glc.setMode('single');
//glc.setEasing(false);
glc.setMaxColors(256);
glc.setQuality( 1 );
var list = glc.renderList,
width = glc.w,
height = glc.h,
color = glc.color;
// your code goes here:
glc.styles.backgroundColor = '#fff';
var size = 140;
var points = 6;
// var innerRatio = 0.5 * ( 3 - Math.sqrt( points ) ); // from http://www.jdawiseman.com/papers/easymath/surds_star_inner_radius.html
var innerRatio = ( Math.sqrt( 3 )/3 ); // from http://www.jdawiseman.com/papers/easymath/surds_star_inner_radius.html
/*
list.addStar({
x: width / 2,
y: height / 2,
outerRadius: [ size, innerRatio * size ],
innerRadius: [ innerRatio * size, size ],
points: points,
rotation: [ -90, (180/points)-90 ],
stroke: true,
//fillStyle: '#000',
fill: false,
});
*/
var numberOfCircles = 10;
for(i = 0; i < numberOfCircles; i++){
list.addStar({
x: width / 2,
y: height / 2,
outerRadius: [ size, innerRatio * size ],
innerRadius: [ innerRatio * size, size ],
points: points,
rotation: [ -90*i, (180/points)-90 ],
stroke: true,
//fillStyle: '#000',
fill: false,
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment