为了账号安全,请及时绑定邮箱和手机立即绑定

海葵没出来

老师海葵没出来,为什么你的海葵就出来了呢?

正在回答

1 回答

var aneObj = function(){
	this.x = [];
	this.h = [];
}

aneObj.prototype.num = 50;
aneObj.prototype.init = function(){
	for (var i = 0; i < this.num; i++) {
		this.x[i] = i * 16 + Math.random();
		this.h[i] = 200 + Math.random() * 50;
	};
}
aneObj.prototype.draw = function(){
	ctx2.save();
	ctx2.globalAlpha = 0.6;
	ctx2.lineWidth = 20;
	ctx2.lineCap = 'round';
	ctx2.strokeStyle = '#3b154e';
	for (var i = 0; i < this.num; i++) {
		// beginPath,moveTo,lineTo,stroke,strokeStyle,lineWidth,lineCap,globalAlpha
		ctx2.beginPath();
		ctx2.moveTo(this.x[i], canHeight);
		ctx2.lineTo(this.x[i], canHeight - this.h[i]);
		ctx2.stroke();
	};
	ctx2.restore();
}


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
HTML5小游戏---爱心鱼(上)
  • 参与学习       92353    人
  • 解答问题       550    个

学做HTML5游戏,轻轻松松带你上手,适合刚入手游戏开发的同学

进入课程

海葵没出来

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信