diff --git a/README.md b/README.md index 4eb4dc8..ec575f8 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ 待实现特性 -- gif/webp动图显示与控制 - 内存降采样优化,节约内存的占用 - 支持自定义图片解码 @@ -39,7 +38,7 @@ - 不支持drawLifeCycle接口,通过canvas自会图片 - mainScaleType,border等参数,新版本与系统Image保持一致 -- gif/webp动图播放与控制 +- gif/webp动图播放与控制(ImageAnimator实现) - 抗锯齿相关参数 ## 下载安装 diff --git a/entry/src/main/ets/pages/ImageAnimatorPage.ets b/entry/src/main/ets/pages/ImageAnimatorPage.ets index 4efadcb..b63c56e 100644 --- a/entry/src/main/ets/pages/ImageAnimatorPage.ets +++ b/entry/src/main/ets/pages/ImageAnimatorPage.ets @@ -19,7 +19,22 @@ import { AnimatorOption, ImageKnifeAnimatorComponent,ImageKnifeOption } from "@o struct ImageAnimatorPage { @Local animatorOption: AnimatorOption = new AnimatorOption({ state: AnimationStatus.Running, - iterations: -1 + iterations: -1, + onFinish:()=>{ + console.log("ImageKnifeAnimatorComponent animatorOption onFinish") + }, + onStart:()=>{ + console.log("ImageKnifeAnimatorComponent animatorOption onStart") + }, + onPause:()=>{ + console.log("ImageKnifeAnimatorComponent animatorOption onPause") + }, + onCancel:()=>{ + console.log("ImageKnifeAnimatorComponent animatorOption onCancel") + }, + onRepeat:()=>{ + console.log("ImageKnifeAnimatorComponent animatorOption onRepeat") + } }) @Local animatorOption1: AnimatorOption = new AnimatorOption({ state: AnimationStatus.Initial @@ -33,15 +48,9 @@ struct ImageAnimatorPage { Flex(){ Button("播放").onClick(()=>{ this.animatorOption.state = AnimationStatus.Running - this.animatorOption.onStart = ()=>{ - console.log("ImageKnifeAnimatorComponent animatorOption onStart") - } }) Button("暂停").onClick(()=>{ this.animatorOption.state = AnimationStatus.Paused - this.animatorOption.onFinish = ()=>{ - console.log("ImageKnifeAnimatorComponent animatorOption onFinish") - } }) Button("停止").onClick(()=>{ this.animatorOption.state = AnimationStatus.Stopped