qq_一帆风顺_0
2015-10-15 17:15
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 * 16 + Math.random() * 20;//[0,1) this.len[i] = 200 + Math.random() * 50; } } aneObj.prototype.draw = function() { ctx2.save(); ctx2.globalAlbha = 0.6; for (var i = 0; i < this.num; i++) { //beginPath,moveTo,linTo,stroke,starokeStyle,linewidth,lineCap,globalAlbha ctx2.beginPath(); ctx2.moveTo(this.x[i],canHeight); ctx2.lineTo(this.x[i],canHeight - this.len[i]); ctx2.lineWidth = 20; ctx2.lineCap = "round"; ctx2.starokeStyle = "#3b154e"; ctx2.stroke(); } ctx2.restore(); }
ctx2.strokeStyle = "#3b154e"; 你写的strokeStyle 多了一个a
透明效果的 17行的ctx2.globalAlbha = 0.6; 應該為globalAlpha
HTML5小游戏---爱心鱼(上)
92350 学习 · 551 问题
相似问题