我有我的代码的这一部分,我只需要弯曲相反的直接。 它会创建一条从点到鼠标的线条。我需要它向下弯曲。 我会改变什么价值来做这件事?
if ((mouseX-targetPointX<0 && mouseY-targetPointY>0) || (mouseX-targetPointX>=0 && mouseY-targetPointY<=0))
{
if (mouseY-targetPointY>0)
{
line.moveTo(mouseX-offset,mouseY-offset);
line.curveTo(mouseX-offset,targetPointY-offset,targetPointX-offset,targetPointY-offset);
line.lineTo(targetPointX+offset,targetPointY+offset);
line.curveTo(mouseX+offset,targetPointY+offset,mouseX+offset,mouseY+offset);
}
else
{
line.moveTo(mouseX-offset,mouseY-offset);
line.curveTo(targetPointX-offset,mouseY-offset,targetPointX-offset,targetPointY-offset);
line.lineTo(targetPointX+offset,targetPointY+offset);
line.curveTo(targetPointX+offset,mouseY+offset,mouseX+offset,mouseY+offset);
}
}
else
{
if (mouseX<targetPointX && mouseY<targetPointY)
{
line.moveTo(mouseX-offset,mouseY+offset);
line.curveTo(targetPointX-offset,mouseY+offset,targetPointX-offset,targetPointY+offset);
line.lineTo(targetPointX+offset,targetPointY-offset);
line.curveTo(targetPointX+offset,mouseY-offset,mouseX+offset,mouseY-offset);
}
else
{
line.moveTo(mouseX-offset,mouseY+offset);
line.curveTo(mouseX-offset,targetPointY+offset,targetPointX-offset,targetPointY+offset);
line.lineTo(targetPointX+offset,targetPointY-offset);
line.curveTo(mouseX+offset,targetPointY-offset,mouseX+offset,mouseY-offset);
}
}
line.endFill();
}
}
答案 0 :(得分:0)
您需要更改curveTo
方法中的控制点,这是前2个参数。
curveTo(controlPointX,controlPointY,targetX,targetY);