Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onGLC(glc) {
- glc.loop();
- glc.size(300, 300);
- glc.setDuration(3);
- glc.setFPS(17);
- //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 = 80,
- rad = 100;
- //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.addOval({
- translationX: width/2,
- translationY: height/2,
- x: [xpos,oppXpos],
- y: [ypos,oppYpos],
- rx: 100,
- ry: 25,
- lineWidth:.6,
- rotation: [pointDirection(xpos,ypos,pointToX,pointToY),pointDirection(pointToX,pointToY,xpos,ypos)],
- // fillStyle: color.randomRGB(),
- stroke: true,
- fill: false,
- strokeStyle: "yellow",
- phase: i*0.001
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment