Advertisement
xeromino

grid

Nov 24th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function onGLC(glc) {
  2.     glc.loop();
  3.     // glc.playOnce();
  4.     glc.size(540, 540);
  5.     glc.setDuration(2.5);
  6.     glc.setFPS(40);
  7.     glc.setMode("single");
  8.     glc.styles.backgroundColor = "rgba(255,255,255,.3)";
  9.     // glc.setEasing(false);
  10.    
  11.     var list = glc.renderList,
  12.         width = glc.w,
  13.         height = glc.h,
  14.         color = glc.color;
  15.  
  16.     // your code goes here:
  17.    
  18.     var edge = width/4
  19.         num = 4,
  20.         sz = (width-2*edge)/num;
  21.    
  22.     for (var x=edge; x<=width-edge; x+=sz) {
  23.         for (var y=edge; y<=height-edge; y+=sz){
  24.         var s2=6, s = Math.floor(3+Math.random()*s2),
  25.             r = Math.random()*360;
  26.             if (Math.random()*1>.1){
  27.                 list.addPoly({
  28.                     x: x,
  29.                     y: y,
  30.                     sides: s,
  31.                     rotation: [r,r+360],
  32.                     lineWidth: 1,
  33.                     //fill:false,
  34.                     fillStyle: "rgba(255,0,125,.3)",
  35.                     //fillStyle: color.hsv(360/s2*s,.8,.8),
  36.                     stroke: true,
  37.                     strokeStyle: "rgba(0,0,0,.8)",
  38.                     radius: sz*.4,
  39.                     shake: 5
  40.                 });
  41.             }
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement