Advertisement
xeromino

colors

Nov 22nd, 2015
327
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 = "black";
  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 num = 10, d = 200;
  19.     var TWO_PI = Math.PI*2;
  20.    
  21.     for (var i=0; i<num; i++) {
  22.         var px = width/2 + Math.cos(-Math.PI/2+TWO_PI/num*i)*d,
  23.             py = height/2 + Math.sin(-Math.PI/2+TWO_PI/num*i)*d,
  24.             dx = width/2 + Math.cos(-Math.PI/2+TWO_PI/num*((i+1)%num))*d,
  25.             dy = height/2 + Math.sin(-Math.PI/2+TWO_PI/num*((i+1)%num))*d,
  26.             s1 = 3+i,
  27.             s2 = 4+i,
  28.             col1 = 360.0/num*i,
  29.             col2 = 360.0/num*(i+1);
  30.        
  31.         if (i>=num/2) {
  32.             s1 = 3+num-i;
  33.             s2 = s1-1;
  34.         }
  35.  
  36.         list.addPoly({
  37.             x:  [px,dx],
  38.             y:  [py,dy],
  39.             radius: 50,
  40.             fillStyle: color.animHSV(col1,col2,.9,.9,.9,.9),
  41.             stroke: true,
  42.             strokeStyle: "white",
  43.             lineWidth:2,
  44.             sides: [s1,s2]
  45.         });
  46.        
  47.     }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement