Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onGLC(glc) {
- glc.loop();
- glc.size(400, 400);
- glc.setDuration(3);
- glc.setFPS(30);
- //glc.setMode("single");
- // glc.setEasing(false);
- glc.setMaxColors(50);
- //glc.setQuality(1);
- glc.styles.backgroundColor = "black";
- var list = glc.renderList,
- width = glc.w,
- height = glc.h,
- color = glc.color;
- var numParts = 100,
- rad = 150;
- //credit to stackexchange
- function pointDirection(x1, y1, x2, y2) {
- return Math.atan2(y2 - y1, x2 - x1) * 180 / Math.PI;
- }
- for (var i = 0; i < numParts; i++) {
- xpos = Math.cos(2 * Math.PI * i / numParts) * rad;
- ypos = Math.sin(2 * Math.PI * i / numParts) * rad;
- oppXpos = Math.cos(2 * Math.PI * (i+numParts/2) / numParts) * rad;
- oppYpos = Math.sin(2 * Math.PI * (i+numParts/2) / numParts) * rad;
- pointToX = Math.cos(2 * Math.PI * (i-1) / numParts) * rad;
- pointToY = Math.sin(2 * Math.PI * (i-1) / numParts) * rad;
- list.addRect({
- translationX: width/2,
- translationY: height/2,
- x: [xpos,oppXpos],
- y: [ypos,oppYpos],
- //rx: 100,
- //ry: 25,
- w: 30,
- h: 60,
- lineWidth:.6,
- rotation: [pointDirection(xpos,ypos,pointToX,pointToY),pointDirection(pointToX,pointToY,xpos,ypos)],
- fillStyle: color.randomRGB(),
- //stroke: true,
- fill: true,
- //fillStyle: [color.rgba(255,255,0,0.2),color.rgba(255,0,0,0.2)],
- phase: i*0.002
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment