1 var IS_SKV8 = typeof document == "undefined";
2 var HAS_PATH = typeof Path2D != "undefined";
4 function circlePath(r) {
7 p.arc(0, 0, r, 0, 2*Math.PI);
15 var onDraw = function() {
18 var NumParticles = 100;
24 for (var i = 0; i < NumParticles; i++) {
26 x: Math.floor(Math.random()*W),
27 y: Math.floor(Math.random()*H),
28 r: Math.floor(Math.random()*7+1),
29 path: circlePath(Math.random()*7+1),
34 ctx.fillStyle = "#ADD8E6";
35 ctx.fillRect(0, 0, W-1, H-1);
36 ctx.fillStyle = "#FFFFFF";
39 for (var i = 0; i < particles.length; i++) {
41 p.x += Math.floor(Math.sin(angle)*5.0);
54 ctx.translate(p.x, p.y);
60 ctx.arc(p.x, p.y, p.r, 0, 2*Math.PI, true);
75 setTimeout(fps, 1000);
78 setTimeout(fps, 1000);
84 window.onload = function(){
85 var canvas = document.getElementById("snow");
86 var ctx = canvas.getContext("2d");
87 function drawCallback() {
89 setTimeout(drawCallback, 1);
91 setTimeout(drawCallback, 1);
95 console.log("HAS_PATH: " + HAS_PATH);