From bebbc865f7f5cbde6fb92c4b6e62c9a887c2b158 Mon Sep 17 00:00:00 2001 From: zgf Date: Thu, 15 Aug 2024 14:44:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9README=E5=BE=85=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E7=89=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zgf --- README.md | 3 +-- .../src/main/ets/pages/ImageAnimatorPage.ets | 23 +++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) 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