直线 | Line

通过 widthrotation 来定义直线。

关键属性

width:number

线的长度

const line = new Line({
  width: 100,
  stroke: 'rgb(50,205,121)',
})

rotation:number

旋转角度, 取值范围: -180 ~ 180。

line.rotation = 90

计算属性

toPoint: IPointData

画到某一点 setter, 自动换算出 widthrotation

line.toPoint = { x: 0, y: 100 }

获取目标点坐标 getter ,根据 widthrotation自动换算。

line.toPoint // {x: 0, y: 100}

继承属性

图层属性 Layer

布局属性 Layout

描边样式 Stroke

特效样式 Effect

继承

UI > Leaf