eriknau

squares2

Jan 24th, 2016
118
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(350, 350);
  4.      glc.setDuration(3);
  5.      glc.setFPS(20);
  6.      glc.setMode("single");
  7.      glc.setEasing(false);
  8.      glc.setMaxColors(24);
  9.    
  10.     glc.styles.backgroundColor = "black";
  11.  
  12.     var list = glc.renderList,
  13.         width = glc.w,
  14.         height = glc.h,
  15.         color = glc.color;
  16.  
  17.     var numSquares = 90,
  18.         diameter = 100,
  19.         squareSize = 100;
  20.  
  21.     var container = list.addContainer({
  22.         x: width / 2,
  23.         y: height / 2,
  24.     });
  25.  
  26.  
  27.     for (var i = 0; i < numSquares; i++) {
  28.         newX = Math.cos(2 * Math.PI * i / numSquares) * diameter;
  29.         newY = Math.sin(2 * Math.PI * i / numSquares) * diameter;
  30.         newX2 = Math.cos(2 * Math.PI * (i+numSquares/2) / numSquares) * diameter;
  31.         newY2 = Math.sin(2 * Math.PI * (i+numSquares/2) / numSquares) * diameter;
  32.         list.addRect({
  33.             x: newX,
  34.             y: newY,
  35.             fill: false,
  36.             stroke: true,
  37.             strokeStyle: "white",
  38.             w: squareSize,
  39.             h: squareSize,
  40.             rotation: [0,90],
  41.             lineWidth: 1.5,
  42.             parent: container,
  43.         })
  44.     };
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment