Advertisement
xeromino

petals

Nov 25th, 2015
189
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.setMode("single");
  8.     glc.styles.backgroundColor = "white";
  9.     // glc.setEasing(false);
  10.    
  11.     var list = glc.renderList,
  12.         width = glc.w,
  13.         height = glc.h,
  14.         color = glc.color;
  15.    
  16.     var rad = 150, num = 25, TWO_PI = Math.PI*2;
  17.    
  18.     var gradient = color.createRadialGradient(0, 0, 0, 0, 0, rad);
  19.     gradient.addColorStop(1, "#BB377D");
  20.     gradient.addColorStop(0, "#FBD3E9");
  21.  
  22.     // your code goes here:
  23.     for (var i=0; i<num; i++) {
  24.         var start = 360.0/num*i,
  25.             end = 360.0/num*(i+1);
  26.         //var r =
  27.         var px = width/2 + Math.cos(TWO_PI/num*(i+0.5))*width*.8,
  28.             py = height/2 + Math.sin(TWO_PI/num*(i+0.5))*height*.8;
  29.         list.addCircle({
  30.             x: [width/2,px],
  31.             y: [height/2,py],
  32.             radius: [100,rad],
  33.             rotation: [0,90],
  34.             startAngle: start,
  35.             endAngle: end,
  36.             drawFromCenter: true,
  37.             fillStyle: gradient,
  38.             phase: 1.0/num*i
  39.  
  40.         });
  41.     }
  42.     /*
  43.     list.addCircle({
  44.         x: width/2,
  45.         y: height/2,
  46.         radius: [0,rad],
  47.         fillStyle: gradient
  48.    
  49.     });
  50. */
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement