Skip to content

三角形

PropertyDescriptionTypeRequiredDefault
width宽度numbertrue0
height高度numbertrue0
fill填充颜色string | Gradientfalse-
stroke描边颜色stringfalse-
strokeWidth描边宽度numberfalse1
strokeDashArray描边点划线number[]false-
strokeDashOffset描边点划线偏移numberfalse0
strokeLineCap开放自路径两端的形状CanvasLineCapfalse-
strokeLineJoin转角处形状CanvasLineJoinfalse-
strokeMiterLimit转角最大距离numberfalse4

示例

Source Code
js
const rubbing = new Rubbing({
  selector: '#canvas',
  background: '#fff',
  width: 300,
  height: 200,
})
await rubbing.init()
rubbing.loadFrom({
  objects: [
    {
      type: 'rect',
      fill: '#7c3aed',
      left: 50,
      top: 0,
      width: 200,
      height: 150,
    },
  ],
})