Commit 474f1e19 by doszhang

dos

parent cc8f6b80
......@@ -47,7 +47,7 @@ window.requestAnimationFrame =
window.setTimeout(callback, 1000 / 60);
};
var canvas, ctx, w, h, particles = [],
var fireworkCanvas, fireworkCtx, w, h, particles = [],
probability = 0.04,
xPoint, yPoint;
......@@ -261,7 +261,7 @@ function update() {
function paint() {
fireworkCtx.globalCompositeOperation = 'lighter';
for (var i = 0; i < particles.length; i++) {
particles[i].draw(ctx);
particles[i].draw(fireworkCtx);
for (k in particles[i].children) {
particles[i].children[k].w -= 0.205
particles[i].children[k].draw(fireworkCtx)
......@@ -309,8 +309,8 @@ Particle.prototype = {
this.vy += this.gravity;
this.y += this.vy;
this.alpha -= 0.01;
if (this.x <= -this.w || this.x >= canvas.width ||
this.y >= canvas.height ||
if (this.x <= -this.w || this.x >= fireworkCanvas.width ||
this.y >= fireworkCanvas.height ||
this.alpha <= 0) {
this.alpha = 0
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment