shadow
绘制阴影。
关键属性
shadow: ShadowEffect
| ShadowEffect
[]
外阴影, 支持多个阴影叠加、boxShadow 效果。
ts
interface ShadowEffect {
x: number
y: number
blur: number
spread?: number
color: Color
blendMode?: BlendMode
visible?: boolean
box?: boolean // 和 CSS3 中的 boxShadow 效果一致, 只显示图形外部的阴影
}
归属
UI
示例
绘制阴影
ts
import { Leafer, Rect } from 'leafer-ui'
const leafer = new Leafer({ view: window })
const rect = new Rect({
width: 100,
height: 100,
cornerRadius: 30,
fill: 'rgba(50,205,121,0.7)',
shadow: {
x: 10,
y: -10,
blur: 20,
color: '#FF0000AA'
}
})
leafer.add(rect)
绘制 boxShadow 阴影
ts
import { Leafer, Rect } from 'leafer-ui'
const leafer = new Leafer({ view: window })
const rect = new Rect({
width: 100,
height: 100,
cornerRadius: 30,
fill: 'rgba(50,205,121,0.7)',
shadow: {
x: 10,
y: -10,
blur: 20,
color: '#FF0000AA',
box: true
}
})
leafer.add(rect)