Advertisement
xeromino

gridPulse

Feb 7th, 2016
344
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, 540);
  4.      glc.setDuration(2.5);
  5.      glc.setFPS(25);
  6.      glc.styles.backgroundColor = "#202020";
  7.    //glc.setMode('single');
  8. //     glc.setEasing(false);
  9.     var list = glc.renderList,
  10.         width = glc.w,
  11.         height = glc.h,
  12.         color = glc.color;
  13.  
  14.     // your code goes here:
  15.    
  16.    
  17.     var cols = 13,
  18.         rows = cols,
  19.         step = width/cols;
  20.    
  21.    
  22.     for (var x=-3*step; x<width+3*step; x += step) {
  23.         for (var y=-3*step; y<height+3*step; y+= step) {
  24.             var dx1 = x,
  25.                 dy1 = y,
  26.                 dx2 = width/2,
  27.                 dy2 = height/2,
  28.                 dx3 = dx2-dx1,
  29.                 dy3 = dy2-dy1,
  30.                 dist1 = Math.sqrt(dx3*dx3 + dy3 * dy3),
  31.                 a = 30/dist1;
  32.            
  33.             list.addCube({
  34.                 x: x,
  35.                 y:y,
  36.                 //y: [y,y-step],
  37.                 strokeStyle: color.rgba(255,255,255,a),
  38.                 size: step*.5,
  39.                 rotationX: [0,90],
  40.                 rotationY: [0,90],
  41.                 rotationZ: [0,90],
  42.                 phase: dist1*-0.001,
  43.             });      
  44.         }
  45.     }
  46.    
  47.    
  48.     list.addText({
  49.         x: width-50,
  50.         y: height-15,
  51.         text: "p5art.tumblr.com",
  52.         fontSize: 10,
  53.         fillStyle: color.rgba(255,255,255,.5),
  54.        
  55.     });
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement