園區(qū)做網(wǎng)站國(guó)外免費(fèi)建站網(wǎng)站
ArkTS卡片開放了使用動(dòng)畫效果的能力,支持顯式動(dòng)畫、屬性動(dòng)畫、組件內(nèi)轉(zhuǎn)場(chǎng)能力。需要注意的是,ArkTS卡片使用動(dòng)畫效果時(shí)具有以下限制:
?
以下示例代碼實(shí)現(xiàn)了按鈕旋轉(zhuǎn)的動(dòng)畫效果:
@Entry
@Component
struct AttrAnimationExample {
@State rotateAngle: number = 0;build() {
Column() {
Button('change rotate angle')
.onClick(() => {
this.rotateAngle = 90;
})
.margin(50)
.rotate({ angle: this.rotateAngle })
.animation({
curve: Curve.EaseOut,
playMode: PlayMode.AlternateReverse
})
}.width('100%').margin({ top: 20 })
}
}