鸿蒙帧动画需要借助组件ImageAnimator。使用的时候想要让动画动起来需要设置state为AnimationStatus.Running
@Entry
@Component
struct OfficialImageAnimatorPage {
build() {
Column() {
ImageAnimator()
//动画数组
.images([
{src:$r('app.media.icon')},
{src:$rawfile('111.png')},
{src:$rawfile('222.png')},
{src:$rawfile('333.png')},
])
//动画时长
.duration(2000)
.margin({top:30})
.backgroundColor(Color.Green)
//开始
.state(AnimationStatus.Running)
//正序还是倒序
.reverse(false)
.fillMode(FillMode.Forwards)
//重复次数,-1为无限
.iterations(-1)
.width(340)
.height(240)
//动画开始回调函数
.onStart(() &#