Skip to content

Instantly share code, notes, and snippets.

@piratefsh
Created February 5, 2016 16:23
Show Gist options
  • Save piratefsh/17df6d6ae869febda632 to your computer and use it in GitHub Desktop.
Save piratefsh/17df6d6ae869febda632 to your computer and use it in GitHub Desktop.
function onGLC(glc) {
glc.loop();
// glc.size(400, 400);
// glc.setDuration(5);
// glc.setFPS(20);
// glc.setMode('single');
// glc.setEasing(false);
var list = glc.renderList,
width = glc.w,
height = glc.h,
color = glc.color,
styles = glc.styles;
styles.backgroundColor = 'rgba(0, 0, 10, 0,8)';
var n = 42;
var size = 30;
// your code goes here:
for(var i = 0; i < width; i+=n){
for(var j = 0; j < height; j+=n){
var id = (i * j) / (width * height);
var colorStart = 'rgba(' + Math.floor(id * 255) + ', 0, 255, 1)'
var colorEnd = 'rgba(' + Math.floor(id * 100) + ', 255, 255, 0.5)'
list.addCircle({
x: i,
y: j,
radius: [size/3, size],
fillStyle: [colorStart, colorEnd],
phase: Math.sqrt(i*i + j*j)/ Math.sqrt(width*width + height*height)
})
}
}
}
@bit101
Copy link

bit101 commented Feb 5, 2016

try:
var colorStart = color.rgba(id * 255, 0, 255, 1);
var colorEnd = color.rgba(id * 100, 255, 255, 0.5);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment