Created
November 30, 2015 03:19
-
-
Save empireshades/94537f51f5ec72fcbf04 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.playOnce(); | |
// glc.size(400, 400); | |
glc.setDuration(3.5); | |
glc.setFPS(24); | |
// glc.setMode("single"); | |
// glc.setEasing(false); | |
glc.setMaxColors(32); | |
glc.styles.backgroundColor = "rgba(0,0,90,.3)"; | |
var list = glc.renderList, | |
width = glc.w, | |
height = glc.h; | |
// your code goes here: | |
var size = 25; | |
for(var y = 0; y < height; y += size) { | |
for(var x = 0; x < width; x += size) { | |
var dx = width / 2 - x - size / 2, | |
dy = height / 2 - y - size / 2, | |
dist = Math.sqrt(dx * dx + dy * dy); | |
if (x >= width/2) { | |
xoff = (Math.abs(dx)/-dx) * (width/2 + 5) + (width / 2); | |
} else { | |
xoff = (Math.abs(dx)/-dx) * (width/2 + 5) - (width / 2); | |
} | |
if (y >= height/2) { | |
yoff = (Math.abs(dy)/-dy) * (height/2 + 5) + (height / 2); | |
} else { | |
yoff = (Math.abs(dy)/-dy) * (height/2 + 5) - (height / 2); | |
} | |
list.addHeart({ | |
translationX: x, | |
translationY: y, | |
x: [size / 2, xoff], | |
y: [size / 2, yoff], | |
fillStyle: ["red", "pink"], | |
w: [size * 0.95, size * .65], | |
h: [size * 0.65, size * .95], | |
rotation: (Math.abs(dx)/-dx * 90) + ((Math.atan(dy / dx)) * 57.3), | |
shake: [1, 0], | |
phase: dist * 0.004 | |
}) | |
list.addHeart({ | |
translationX: x, | |
translationY: y, | |
x: [size / 2, xoff], | |
y: [size / 2, yoff], | |
fillStyle: "pink", | |
w: [size * 0.95, size * .65], | |
h: [size * 0.65, size * .95], | |
rotation: (Math.abs(dx)/-dx * 90) + ((Math.atan(dy / dx)) * 57.3), | |
phase: -dist * 0.004 | |
}) | |
} | |
} | |
list.addText({ | |
x: width / 2, | |
y: height / 2 - 20, | |
text: "L0VE", | |
fontSize: 40, | |
fontFamily: "Courier New", | |
fillStyle: "white", | |
shake: [0, 20] | |
}) | |
list.addText({ | |
x: width / 2, | |
y: height / 2 + 20, | |
text: "eXplo5ioN", | |
fontSize: 50, | |
fontFamily: "Courier New", | |
fillStyle: ["rgba(0,0,90,0)","white"], | |
shake: [0, 20] | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://twitter.com/jimmie/status/671168647222706176