关于海葵~

来源:2-3 海葵绘制

麓小羽

2016-11-04 11:17

为啥我的海葵的高度和背景图片一样高~~~~~~

写回答 关注

2回答

  • 烟火里
    2017-05-27 21:10:23
    aneObj.prototype.draw=function () {
        for(var i=0;i<this.num;i++){
            //begin moveto lineto stroke strokestyle linewigth linecap globalAlpha closepath
            ctx2.beginPath();//海葵绘制在canvas2上
            ctx2.moveTo(this.x[i],canHeight);//绘制起始点 x y
            ctx2.lineTo(this.x[i],canHeight-this.len[i]);
            ctx2.strokeStyle="purple";//紫色 在stroke之前
            ctx2.stroke();//首先告诉笔触颜色 才能用stroke画
            ctx2.lineWidth=10;
            ctx2.lineCap="round";
            ctx2.globalAlpha=0.6;
            ctx2.closePath();
        }
    };

    我也是海葵的高度和背景图片一样高~~~~~~

  • Feair
    2016-11-05 18:02:01

    最好是贴代码,感觉是你绘制海葵上面出现问题,lineTo()参数看是不是有误

HTML5小游戏---爱心鱼(上)

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

92353 学习 · 550 问题

查看课程

相似问题