LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code
CSS
body {background-color:#fff073}
canvas { background-color:#2f0571; margin: 0 auto; display: block; padding: 5px; }
JS
var mycanvas=document.getElementById("canvas1");
var cntx=mycanvas.getContext('2d'); 
cntx.lineCap = 'round';
cntx.strokeStyle = '#ffeb40';
cntx.lineWidth =0.5;
function turn_it(){
  cntx.beginPath();
  cntx.moveTo(0, 0);
  // How far to move from center
  move_num =2; // try different numbers for unique appearances
  // How far to rotate around center
  rotate_num = 0.04;  // between 0 and 1
  // convert to radians.
  rads = rotate_num * 2 * Math.PI;
  // calculate positioning around center
  for (i=1; i<=100; i++){ 
    distance = i * move_num;
    turn = i * rads;
    // position point to draw from
    x = Math.cos(turn) * distance;
    y = Math.sin(turn) * distance;
     // draw line
    cntx.lineTo(x, y);
  }
}
cntx.translate(cntx.canvas.width/2, cntx.canvas.height/2);
setInterval(
  function () {
  cntx.clearRect(-cntx.canvas.width/2, -cntx.canvas.height/2, cntx.canvas.width, cntx.canvas.height);
  cntx.rotate(.009);  //controls rotation speed
  turn_it.apply();
  cntx.stroke();
  }, 10);
Term
Sat, 04/14/2018 - 20:45

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv