eriknau

3D glasses

Mar 11th, 2017
213
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(400, 400);
  4. //     glc.setDuration(5);
  5. //     glc.setFPS(20);
  6. //     glc.setMode('single');
  7. //     glc.setEasing(false);
  8.     glc.styles.backgroundColor= "#fff"
  9.     var list = glc.renderList,
  10.         width = glc.w,
  11.         height = glc.h,
  12.         color = glc.color;
  13.  
  14.     // your code goes here:
  15.     var p1X = Array(10);
  16.     var p1Y = Array(10);
  17.     var p2X = Array(10);
  18.     var p2Y = Array(10);
  19.     for(var i = 0; i<p1X.length;i++) {
  20.         p1X[i] = Math.random()*400;
  21.         p1Y[i] = Math.random()*400;
  22.         p2X[i] = Math.random()*400;
  23.         p2Y[i] = Math.random()*400;
  24.     }
  25.     var offset = 30;
  26.     var lineThickness = 7;
  27.     var opacity = 0.7;
  28.     list.addPath({
  29.         path: [[p1X[0]+Math.random()*offset,p1Y[0],
  30.                 p1X[1]+Math.random()*offset,p1Y[1],
  31.                 p1X[2]+Math.random()*offset,p1Y[2],
  32.                 p1X[3]+Math.random()*offset,p1Y[3],
  33.                 p1X[4]+Math.random()*offset,p1Y[4],
  34.                 p1X[5]+Math.random()*offset,p1Y[5],
  35.                 p1X[6]+Math.random()*offset,p1Y[6],
  36.                 p1X[7]+Math.random()*offset,p1Y[7],
  37.                 p1X[8]+Math.random()*offset,p1Y[8],
  38.                 p1X[9]+Math.random()*offset,p1Y[9],
  39.                 p1X[0]+Math.random()*offset,p1Y[0]],
  40.                [p2X[0]+Math.random()*offset,p2Y[0],
  41.                 p2X[1]+Math.random()*offset,p2Y[1],
  42.                 p2X[2]+Math.random()*offset,p2Y[2],
  43.                 p2X[3]+Math.random()*offset,p2Y[3],
  44.                 p2X[4]+Math.random()*offset,p2Y[4],
  45.                 p2X[5]+Math.random()*offset,p2Y[5],
  46.                 p2X[6]+Math.random()*offset,p2Y[6],
  47.                 p2X[7]+Math.random()*offset,p2Y[7],
  48.                 p2X[8]+Math.random()*offset,p2Y[8],
  49.                 p2X[9]+Math.random()*offset,p2Y[9],
  50.                 p2X[0]+Math.random()*offset,p2Y[0]]],
  51.         lineWidth: lineThickness,
  52.         strokeStyle: color.rgba(0,255,255,opacity)
  53.     });
  54.     list.addPath({
  55.         path: [[p1X[0],p1Y[0],
  56.                 p1X[1],p1Y[1],
  57.                 p1X[2],p1Y[2],
  58.                 p1X[3],p1Y[3],
  59.                 p1X[4],p1Y[4],
  60.                 p1X[5],p1Y[5],
  61.                 p1X[6],p1Y[6],
  62.                 p1X[7],p1Y[7],
  63.                 p1X[8],p1Y[8],
  64.                 p1X[9],p1Y[9],
  65.                 p1X[0],p1Y[0]],
  66.                [p2X[0],p2Y[0],
  67.                 p2X[1],p2Y[1],
  68.                 p2X[2],p2Y[2],
  69.                 p2X[3],p2Y[3],
  70.                 p2X[4],p2Y[4],
  71.                 p2X[5],p2Y[5],
  72.                 p2X[6],p2Y[6],
  73.                 p2X[7],p2Y[7],
  74.                 p2X[8],p2Y[8],
  75.                 p2X[9],p2Y[9],
  76.                 p2X[0],p2Y[0]]],
  77.         lineWidth: lineThickness,
  78.         strokeStyle: color.rgba(255,0,0,opacity)
  79.     });
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment