eriknau

25Days-11

Dec 11th, 2015
153
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(540, 400);
  4.     glc.setDuration(3);
  5.     // glc.setFPS(20);
  6.     glc.setMode("single");
  7.     // glc.setEasing(false);
  8.     // glc.setMaxColors(256);
  9.     glc.styles.backgroundColor = "#1C99FF";
  10.  
  11.     var list = glc.renderList,
  12.         width = glc.w,
  13.         height = glc.h,
  14.         color = glc.color;
  15.         //credit to stackexchange
  16.     function pointDirection(x1, y1, x2, y2) {
  17.         return Math.atan2(y2 - y1, x2 - x1) * 180 / Math.PI;
  18.     }
  19.         list.addRect({
  20.             x: width,
  21.             y: height-50,
  22.             w: 40,
  23.             h: 104,
  24.             fill: true
  25.         })
  26.  
  27.         list.addOval({
  28.             x: width-15,
  29.             y: height-50,
  30.             rx: 20,
  31.             ry: 50,
  32.             fill: true,
  33.             fillStyle: color.rgb(85,38,0),
  34.             stroke: true,
  35.             strokeWeight: 10,
  36.             strokeStyle: "brown"
  37.         })
  38.         for (var i = 0; i < 50; i++) {
  39.             var y1 = Math.random()*height-50,
  40.                 w = Math.random()*150+30,
  41.                 h = Math.random()*40+130,
  42.                 b = Math.random()*200+55;
  43.  
  44.             list.addArrow({
  45.                 x: [-50,width+50],
  46.                  y: [y1,height-30],
  47.                 w: w,
  48.                 h: [h,5],
  49.                 rotation: pointDirection(-50,y1,width+50,height-50),
  50.                 fillStyle: color.rgb(0,0,b),
  51.                 phase: i*0.06
  52.             })
  53.         };
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment