Created
February 5, 2016 16:23
-
-
Save piratefsh/17df6d6ae869febda632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try:
var colorStart = color.rgba(id * 255, 0, 255, 1);
var colorEnd = color.rgba(id * 100, 255, 255, 0.5);