0

我有我的代码的这部分,我只需要它在相反的方向弯曲。它创建一条从一个点到向上弯曲的鼠标的线。我需要它向下弯曲。我会改变什么价值观来做到这一点?

    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();
}

}
4

1 回答 1

0

您需要更改curveTo方法中的控制点,即前两个参数。

curveTo(controlPointX,controlPointY,targetX,targetY);

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics.html#curveTo()

于 2013-08-08T01:14:13.607 回答