为什么这么大
什么原因啊
什么原因啊
 
                            2017-09-11
var aneObj = function () {
	this.x = [];
	this.len = [];
}
aneObj.prototype.num = 50;
aneObj.prototype.init = function () {
	for(var i =0;i < this.num; i++){
		this.x[i] = i*9 + Math.random()*2;
		this.len[i] = 50 + Math.random()*5;
	}
}
aneObj.prototype.draw = function () {
	ctx2.save();
	ctx2.globalAlpha = 0.6;
	ctx2.lineWidth = 8;
	ctx2.lineCap = "round";
	ctx2.strokeStyle = "#3b154e";
	for(var i =0; i < this.num; i++){
		ctx2.beginPath();
		ctx2.moveTo(this.x[i],canHeight);
		ctx2.lineTo(this.x[i],canHeight - this.len[i]);	
		ctx2.stroke();
	}
	ctx2.restore();
}var fruitObj = function () {
	this.alive = [];//bool
	this.x = [];
	this.y = [];
	this.orange = new Image();
	this.blue = new Image();
}
fruitObj.prototype.num = 30;
fruitObj.prototype.init = function () {
	for( var i = 0;i < this.num; i++){
		this.alive[i] = true;
		this.x[i] = 0;
		this.y[i] = 0;
		this.born(i);
	}
	this.orange.src = "./src/fruit.png";
	this.blue.src= "./src/blue.png";
}
fruitObj.prototype.draw = function () {
	for(var i=0; i < this.num; i++){
		ctx2.drawImage(this.orange,this.x[i],this.y[i]);
	}
}
fruitObj.prototype.born = function (i) {
	var aneId= Math.floor(Math.random()*ane.num)
	this.x[i] = ane.x[aneId];
	this.y[i] = canHeight - ane.len[aneId];
}举报