為啥有個黑圓
var waveObj = function () {
? ? this.x = [];
? ? this.y = [];
? ? this.r = [];
? ? this.alive = [];
? ? this.isBlue = [];
}
waveObj.prototype.num = 10;
waveObj.prototype.init = function () {
? ? for (var i = 0; i < this.num;i++){
? ? ? ? this.alive[i] = false;
? ? ? ? this.r[i] = 0;
? ? ? ? this.isBlue[i]=false;
? ? }
}
waveObj.prototype.draw = function () {
? ? fcontent.save();
? ? for (var i = 0; i < this.num; i++) {
? ? ? ? if (this.alive[i]) {
? ? ? ? ? ? this.r[i] += delaTime * 0.02;
? ? ? ? ? ? if (this.r[i] > 60) {
? ? ? ? ? ? ? ? this.alive[i] = false;
? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? }
? ? ? ? ? ? var alp = 1 - this.r[i] / 100;
? ? ? ? ? ? fcontent.strokeStyle = "rgba(255,255,255," + alp + ")";
? ? ? ? ? ? fcontent.beginPath();
? ? ? ? ? ? fcontent.arc(this.x[i], this.y[i], this.r[i], 0, 2 * Math.PI);
? ? ? ? ? ? fcontent.closePath();
? ? ? ? ? ? fcontent.stroke();
? ? ? ? }
? ? }
? ? fcontent.restore();
}
waveObj.prototype.born = function (x,y) {
? ? for (var i = 0; i < this.num; i++) {
? ? ? ? if (!this.alive[i]) {
? ? ? ? ? ? this.x[i] = x;
? ? ? ? ? ? this.y[i] = y;
? ? ? ? ? ? this.r[i] = 20;
? ? ? ? ? ? this.alive[i] = true;//表示出生
? ? ? ? ? ? //this.isBlue[i] = isBlue;
? ? ? ? ? ? return;
? ? ? ? }
? ? }
}
2016-07-07
?if (this.r[i] > 60) {
? ? ? ? ? ? ? ? this.alive[i] = false;
? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? }
?continue;改成break;