ࡱ > A C @ { R % bjbjzz 2, R ( \ \ 8 " , N N ( v v v = F 9 v v 4 S B v v v @j i 0 5 5 5 ` 5 \ , : 2 5 S9_ 0RvMR:NbkbNO(uv:yOvQ[l gLu0_N1\/fS_b_ryR0R;u^vLuYeNHNlSu[NS/fm1Y(WbNvƉΑ-NQ_Nw NN0ُ_N/f`O vHeg0OYYg`OS/fR^ Nk{wvR;uv^NR;u(W0RLuKNMR1\O\Pbkb`O^gb_ryR0R;u^KNY0FO/fYg`O N ُyL:N`HNRYg`O^gb_rYawhTVvsXb(WLuYS9_Veg`HNRbTُyL:NSNMQ:gh'`vR;uOR;ufR6qT:g0 (Wf[`NYUO[sُyL:NKNMRHQ(u,gzvb/gQYNNx v a r c a n v a s W i d t h = canvas.width(); var canvasHeight = canvas.height(); var playAnimation = true; var startButton = $("#startAnimation"); var stopButton = $("#stopAnimation"); startButton.hide(); startButton.click(function() { $(this).hide(); stopButton.show(); playAnimation = true; animate(); }); stopButton.click(function() { $(this).hide(); startButton.show(); playAnimation = false; }); var Shape = function(x, y, width, height) { this.x = x; this.y = y; this.width = width; this.height = height; }; var shapes = new Array(); for (var i = 0; i < 10; i++) { var x = Math.random()*250; var y = Math.random()*250; var width = height = Math.random()*30; shapes.push(new Shape(x, y, width, height)); }; function animate() { context.clearRect(0, 0, canvasWidth, canvasHeight); var shapesLength = shapes.length; for (var i = 0; i < shapesLength; i++) { var tmpShape = shapes[i]; context.fillRect(tmpShape.x, tmpShape.y, tmpShape.width, tmpShape.height); }; if (playAnimation) { setTimeout(animate, 33); }; }; animate(); ُNNx^zN N*N[tevR;u_s勪_s\MS1 0 *N:gubvb_r0Nxv^l g(WƉɉ NyRNUOb_rV:NbNl gO9eR;u_s-Nb_rv^\'`YXRx v