我试图创建这些移动的形状,该形状由半圆形和对称的上弧和下弧组成。
它们应该只是前面的形状,但现在当它们移动时,后面会拖着一条像尾巴一样的线。尾部未知的输出形状
这些线似乎来自上下弧的 moveTo 部分,但我不知道如何解决它。
我应该在哪里改变才能摆脱它?
function Fish(x, y, dx, dy, radius){
this.x = x;
this.y = y;
this.dx = dx;
this.dy = dy;
this.radius = 30;
this.draw = function(){
c.beginPath();
c.arc(this.x/0.6, this.y, this.radius, Math.PI * 1.5, Math.PI * 0.5, false)
//Upper Arc
c.moveTo(this.x, this.y);
c.arc(this.x/0.6, this.y+(3*this.radius), this.radius*4, Math.PI * 229/180, Math.PI * 1.5, false)
//Lower Arc
c.moveTo(this.x, this.y);
c.arc(this.x/0.6, this.y-(3*this.radius), this.radius*4, Math.PI * 131/180 , Math.PI * 0.5, true)
c.strokeStyle = "green";
c.stroke();
}