Skip to content
导航

Star

绘制车标、星光、五角星、多角星形。

关键属性

width: number

宽度。

height: number

高度。

points: number

星形的顶点数,取值范围为 >=3。

innerRadius: number

内半径比例,默认 0.382,取值范围为 0.0 ~ 1.0。

ts
// 五角星
points: 5
innerRadius: 0.382

示例

绘制车标

ts
import { Leafer, Star } from 'leafer-ui'

const leafer = new Leafer({ view: window })

const star = new Star({  
    width: 100,
    height: 100,
    points: 3,
    innerRadius: 0.15,
    fill: 'rgb(50,205,121)'
})

leafer.add(star)

绘制星光

ts
import { Leafer, Star } from 'leafer-ui'

const leafer = new Leafer({ view: window })

const star = new Star({  
    width: 100,
    height: 100,
    points: 4,
    innerRadius: 0.1,
    fill: 'rgb(50,205,121)'
})

leafer.add(star)

绘制五角星

ts
import { Leafer, Star } from 'leafer-ui'

const leafer = new Leafer({ view: window })

const star = new Star({  
    width: 100,
    height: 100,
    points: 5,
    fill: 'rgb(50,205,121)'
})

leafer.add(star)

继承

UI

API

Star

Released under the MIT License.