我已经能够使用 Kinetic JS 成功绘制一条线,如下所示:
var track129 = new Kinetic.Spline({
points: [
{x: 3, y: 400},
{x: 196, y: 400},
{x: 213, y: 395},
{x: 290, y: 345},
{x: 319, y: 324},
{x: 389, y: 253},
{x: 457, y: 184},
{x: 471, y: 173},
{x: 481, y: 173},
{x: 682, y: 173}, // this is where the blue track branches to the red track (129, 009).
{x: 708, y: 171},
{x: 740, y: 186},
{x: 773, y: 218},
{x: 799, y: 240},
{x: 822, y: 251},
{x: 845, y: 254},
{x: 866, y: 251},
{x: 894, y: 238},
{x: 934, y: 204}
],
stroke: 'blue',
strokeWidth: 2,
lineCap: 'round',
tension: .2
});
layer.add(track129);
然后我使用以下命令旋转该行:
track129.setRotationDeg(45);
视觉显示更新。然后我尝试从旋转线中取出转换点,如下所示:
var mySpleenPoints = track129.getPoints();
我最终得到了与我输入时相同的点数组。我试图获得偏移和平移,以查看是否可以得出旋转点的绝对坐标,但我没有运气。谁能帮我提取实际的翻译值?