Tips & Trix Kanalen - LiaochKnutens
]; window.addEventListener('resize', function(){ canvas.width = window.innerWidth; canvas.height = window.innerHeight; init(); }); Circle = function(x, y, dx, dy, radius) { this.x = x; this.dx = dx; this.y = y; this.dy = dy; this.radius = radius; this.minRadius = radius; this.color = colorArray[Math.floor(Math.random() * colorArray.length)]; this.draw = function(){ context.beginPath(); context.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false); context.fillStyle = this.color; context.fill(); } this.update = function(){ if(this.x + this.radius > innerWidth || this.x - this.radius < 0) { this.dx = -this.dx; } if(this.y + this.radius > innerHeight || this.y - this.radius < 0) { this.dy = -this.dy; } this.x += this.dx; this.y += this.dy; this.draw(); } }; var circleArray = []; function init () { circleArray = []; for (var i = 0; i < 300; i++) { var radius = Math.random() * 3 + 1; var x = Math.random() * (innerWidth - radius * 2) + radius; var y = Math.random() * (innerHeight - radius * 2) + radius; var dx = (Math.random() - 0.5) * 2; var dy = (Math.random() - 0.5) * 2; circleArray.push(new Circle(x, y, dx, dy, radius)); } } function animate() { requestAnimationFrame(animate); context.clearRect(0, 0, innerWidth, innerHeight); for (var i = 0; i < circleArray.length; i++) { circleArray[i].update(); } } init(); animate(); }).call(this);

Tips & Trix Kanalen

Del 1. Ytterplagg

I Tips & Trix Kanalen Del:1 Ytterplagg, vill vi guida dig med 5 tips till rätt val av ytterplagg just för dig och dina önskemål