Commit 11afe7fa by doszhang

dos

parent 120167b1
......@@ -215,24 +215,24 @@ function init() {
}
function onLoad() {
$('.canvas-block').html('<canvas id="canvas"></canvas>');
canvas = document.getElementById("canvas");
ctx = canvas.getContext("2d");
$('.canvas-block').html('<canvas id="fireworkCanvas"></canvas>');
fireworkCanvas = document.getElementById("fireworkCanvas");
fireworkCtx = canvas.getContext("2d");
resizeCanvas();
window.requestAnimationFrame(updateWorld);
}
function resizeCanvas() {
if (!!canvas) {
w = canvas.width = 640;
h = canvas.height = 1400;
if (!!fireworkCanvas) {
w = fireworkCanvas.width = 640;
h = fireworkCanvas.height = 1400;
}
}
function updateWorld() {
canvas.width = 641;
canvas.width = 640;
fireworkCanvas.width = 641;
fireworkCanvas.width = 640;
update();
paint();
if (!fireworkLock) {
......@@ -259,12 +259,12 @@ function update() {
}
function paint() {
ctx.globalCompositeOperation = 'lighter';
fireworkCtx.globalCompositeOperation = 'lighter';
for (var i = 0; i < particles.length; i++) {
particles[i].draw(ctx);
for (k in particles[i].children) {
particles[i].children[k].w -= 0.205
particles[i].children[k].draw(ctx)
particles[i].children[k].draw(fireworkCtx)
}
}
}
......
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