LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code
CSS
body {
  margin: 0;
  background: black;
}
JS
var canvas = $("canvas#bg")[0];

canvas.height = $(window).height();
canvas.width = $(window).width();

var ctx = canvas.getContext("2d");


ctx.strokeStyle = "#222";
ctx.lineWidth = 2;

function drawCircle(radius, offset, sectionAngle, strokeAngle) {
	var start = (-0.5 * Math.PI) + offset;
	var end = (1.5 * Math.PI) + offset;
	if(sectionAngle <= 0) return;
	for(var i = start; i < end; i+=sectionAngle) {
		ctx.beginPath();
		ctx.arc(canvas.width/2, canvas.height/2, radius, i, i + strokeAngle);
	ctx.stroke();
	ctx.closePath();
	}
}

var change = 0;

var k = setInterval(function() {
	ctx.clearRect(0, 0, canvas.width, canvas.height);
	change += 0.01;
	var sign = 1;
	if(change > Math.PI) change = 0;
	for(var i = 10; i < 500; i+= 7) {
		if(i % 3 == 0) sign = -1;
		else if(i % 3 == 1) sign = 0;
		else sign = 1;
		drawCircle(i, change*sign, 0.1*Math.PI, 0.05*Math.PI);
	}
}, 40);
Term
Sat, 01/13/2018 - 16:14

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv