JavaScript Dersleri
JavaScript Dersleri
requestAnimationFrame
JavaScript Kodu
var canvas = document.getElementsByTagName("canvas")[0];
var c = canvas.getContext('2d');
var r = 10*Math.random();
var pix2 = Math.PI * 2;
var cr = 100;
function draw(){
c.clearRect(0,0,innerWidth,innerHeight);
for (var i = 5; i < cr; i++) {
c.beginPath();
c.fillStyle = "hsla("+360 * Math.random()+", 100%, 50%,1)";
c.arc(545*Math.random(),350*Math.random(),r,pix2,false);
c.fill();
};
requestAnimationFrame(draw);
};
draw();
|