eriknau

25Days-8

Dec 8th, 2015
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function onGLC(glc) {
  2.     glc.loop();
  3.     // glc.size(400, 400);
  4.     glc.setDuration(3);
  5.     // glc.setFPS(20);
  6.     // glc.setMode("single");
  7.     glc.setEasing(false);
  8.     // glc.setMaxColors(256);
  9.     var r = 20, g = 20, b = 150;
  10.     glc.styles.backgroundColor = "rgba("+r+","+g+","+b+",0.1)";
  11.  
  12.     var list = glc.renderList,
  13.         width = glc.w,
  14.         height = glc.h,
  15.         color = glc.color;
  16.  
  17.     var numCircles = 6, span = 70;
  18.  
  19.      for (var k = span; k < height; k+=span) {
  20.         for (var j = span; j < width; j+=span) {
  21.                 var rad = Math.random()*15+10,
  22.                 endRad = rad / 5,
  23.                 circleRadius = Math.PI*rad / numCircles,
  24.                 flowerColor = color.randomRGB(70,255);
  25.             var container = list.addContainer({
  26.                 x: j,
  27.                 y: k,
  28.                 rotation: [0, 360 / numCircles*6]
  29.             });
  30.             list.addCircle({
  31.                 x: 0,
  32.                 y: 0,
  33.                 radius: rad,
  34.                 fill: true,
  35.                 fillStyle: flowerColor,
  36.                 parent: container
  37.             })
  38.  
  39.             for (var i = 0; i < numCircles; i++) {
  40.                 newX = Math.cos(2 * Math.PI * i / numCircles) * rad;
  41.                 newY = Math.sin(2 * Math.PI * i / numCircles) * rad;
  42.                 list.addCircle({
  43.                     x: newX,
  44.                     y: newY,
  45.                     fill: true,
  46.                     fillStyle: flowerColor,
  47.                     stroke: false,
  48.                     radius: circleRadius-1,
  49.                     parent: container
  50.                 })
  51.             };
  52.             for (var i = 0; i < numCircles/2; i++) {
  53.                 newX = Math.cos(2 * Math.PI * i / (numCircles / 2)) * rad;
  54.                 newY = Math.sin(2 * Math.PI * i / (numCircles / 2)) * rad;
  55.                 list.addCircle({
  56.                     x: newX,
  57.                     y: newY,
  58.                     fill: true,
  59.                     fillStyle: color.rgb(r,g,b),
  60.                     stroke: false,
  61.                     radius: circleRadius,
  62.                     parent: container
  63.                 })
  64.             };
  65.         };
  66.     };
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment