From b6f10518e6dd27918fb332f6b140d70ab5b9f175 Mon Sep 17 00:00:00 2001 From: zgf Date: Mon, 30 Sep 2024 15:13:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85ImageKnifeAnimatorComponent?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=A6=96=E5=B8=A7=E5=92=8C=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E4=B8=80=E9=98=B5=E6=A0=B7=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zgf --- .../src/main/ets/pages/ImageAnimatorPage.ets | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/entry/src/main/ets/pages/ImageAnimatorPage.ets b/entry/src/main/ets/pages/ImageAnimatorPage.ets index 9269280..a783235 100644 --- a/entry/src/main/ets/pages/ImageAnimatorPage.ets +++ b/entry/src/main/ets/pages/ImageAnimatorPage.ets @@ -19,7 +19,29 @@ import { AnimatorOption, ImageKnifeAnimatorComponent } from "@ohos/libraryimagek struct ImageAnimatorPage { @State animatorOption: 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") + } + } + @State animatorOption1: AnimatorOption = { + state: AnimationStatus.Initial + } + @State animatorOption2: AnimatorOption = { + state: AnimationStatus.Initial, + reverse: true } build() { Column(){ @@ -50,6 +72,22 @@ struct ImageAnimatorPage { errorholderSrc:$r('app.media.failed') },animatorOption:this.animatorOption }).width(300).height(300).backgroundColor(Color.Orange).margin({top:30}) + Text($r('app.string.Display_the_first_frame')).fontSize(20) + ImageKnifeAnimatorComponent({ + imageKnifeOption:{ + loadSrc:"https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658", + placeholderSrc:$r('app.media.loading'), + errorholderSrc:$r('app.media.failed') + },animatorOption:this.animatorOption1 + }).width(200).height(200).backgroundColor(Color.Orange).margin({top:30}) + Text($r('app.string.Display_the_last_frame')).fontSize(20) + ImageKnifeAnimatorComponent({ + imageKnifeOption:{ + loadSrc:"https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658", + placeholderSrc:$r('app.media.loading'), + errorholderSrc:$r('app.media.failed') + },animatorOption:this.animatorOption2 + }).width(200).height(200).backgroundColor(Color.Orange).margin({top:30}) }.width("100%").height("100%") } } \ No newline at end of file