Advertisement
xeromino

rain

Dec 7th, 2015
292
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);
  6.     glc.setFPS(30);
  7.     glc.styles.backgroundColor = "#2D4059";
  8.     glc.setMode("single");
  9.     // glc.setEasing(false);
  10.    
  11.     var list = glc.renderList,
  12.         width = glc.w,
  13.         height = glc.h,
  14.             color = glc.color,
  15.             ox = width/2,
  16.             oy = height/2,
  17.                 TWO_PI = Math.PI*2;
  18.  
  19.     // your code goes here:
  20.  
  21.     var palette = ["#EA5455", "#F07B3F", "#FFD460"],
  22.         step = 10,
  23.         edge = 75;
  24.    
  25.     for (var x=edge; x<=width-edge; x+=step) {
  26.         var s = Math.floor(Math.random()*3);
  27.         list.addRaySegment({
  28.             x: x,
  29.             y: edge,
  30.             angle: 90,
  31.             length: height-2*edge,
  32.             segmentLength: [50,200],
  33.             lineDash: [30, 10, 40, 10],
  34.             lineWidth: 4,
  35.             lineCap: "butt",
  36.             strokeStyle: palette[s],
  37.             phase: x/200,
  38.         });
  39.    }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement