Advertisement
xeromino

abstract01

Feb 7th, 2016
238
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, 540);
  4.     glc.setDuration(2.5);
  5.     glc.setFPS(30);
  6.     glc.setMode('single');
  7. //     glc.setEasing(false);
  8.     var list = glc.renderList,
  9.         width = glc.w,
  10.         height = glc.h,
  11.         color = glc.color;
  12.  
  13.     // your code goes here:
  14.  
  15.     var x = [],
  16.         y = [],
  17.         num = 84,
  18.         d = 200;
  19.    
  20.     for (var i=0; i<num; i++) {
  21.         var offSet = Math.PI*2/num*i;
  22.         x[i] = width/2 + Math.cos(offSet)*d;
  23.         y[i] = height/2 + Math.sin(offSet)*d;
  24.     }
  25.    
  26.     for (var i=0; i<num; i++) {
  27.         list.addSegment({
  28.             x0: x[i],
  29.             y0: y[i],
  30.             x1: x[(i+num/3)%num],
  31.             y1: y[(i+num/2)%num],
  32.             segmentLength: [50,200],
  33.             phase: .5/i+0.1*i,
  34.         });  
  35.     }
  36. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement