直线 | Line
通过 width
与 rotation
来定义直线。
关键属性
width:number
线的长度
const line = new Line({
width: 100,
stroke: 'rgb(50,205,121)',
})
rotation:number
旋转角度, 取值范围: -180 ~ 180。
line.rotation = 90
计算属性
IPointData
toPoint:画到某一点 setter
, 自动换算出 width
与 rotation
。
line.toPoint = { x: 0, y: 100 }
获取目标点坐标 getter
,根据 width
与 rotation
自动换算。
line.toPoint // {x: 0, y: 100}