eriknau

25Days-7

Dec 7th, 2015
109
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(5);
  5.     // glc.setFPS(20);
  6.     // glc.setMode("single");
  7.     // glc.setEasing(false);
  8.     // glc.setMaxColors(256);
  9.     var r = 50, g = 170, b = 255;
  10.     glc.styles.backgroundColor = "rgba("+r+","+g+","+b+",0.15)";
  11.  
  12.     var list = glc.renderList,
  13.         width = glc.w,
  14.         height = glc.h,
  15.         color = glc.color;
  16.  
  17.     var numCircles = 50,
  18.         rad = 170,
  19.         endRad = rad / 5,
  20.         circleRadius = Math.PI*rad / numCircles;
  21.  
  22.     list.addCircle({
  23.         x: width/2,
  24.         y: height/2,
  25.         radius: [rad,endRad],
  26.         fill: true,
  27.         fillStyle: "yellow"
  28.     })
  29.  
  30.     for (var i = 0; i < numCircles; i++) {
  31.         newX = Math.cos(2 * Math.PI * i / numCircles) * rad;
  32.         newY = Math.sin(2 * Math.PI * i / numCircles) * rad;
  33.         newX2 = Math.cos(2 * Math.PI * i / numCircles) * endRad;
  34.         newY2 = Math.sin(2 * Math.PI * i / numCircles) * endRad;
  35.         list.addCircle({
  36.             x: [newX+width/2,newX2+width/2],
  37.             y: [newY+height/2,newY2+height/2],
  38.             fill: true,
  39.             fillStyle: "yellow",
  40.             stroke: false,
  41.             radius: [circleRadius-1,circleRadius / (rad / endRad) - 1]
  42.         })
  43.     };
  44.     for (var i = 0; i < numCircles/2; i++) {
  45.         newX = Math.cos(2 * Math.PI * i / (numCircles / 2)) * rad;
  46.         newY = Math.sin(2 * Math.PI * i / (numCircles / 2)) * rad;
  47.         newX2 = Math.cos(2 * Math.PI * i / (numCircles / 2)) * endRad;
  48.         newY2 = Math.sin(2 * Math.PI * i / (numCircles / 2)) * endRad;
  49.         list.addCircle({
  50.             x: [newX+width/2,newX2+width/2],
  51.             y: [newY+height/2,newY2+height/2],
  52.             fill: true,
  53.             fillStyle: color.rgb(r,g,b),
  54.             stroke: false,
  55.             radius: [circleRadius,circleRadius / (rad / endRad)]
  56.         })
  57.     };
  58. }
Advertisement
Add Comment
Please, Sign In to add comment