From 7ddf5a355fb7037189fc4de0b74729f22cbf1540 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Wed, 20 Dec 2023 16:10:41 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0GIF=E5=87=BD=E6=95=B0=EF=BC=8C?= =?utf8?q?=E5=A2=9E=E5=8A=A0=E5=B8=A7=E9=80=9F=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeapp/nativeui/traing/include/TraingWinView.h | 2 +- .../nativeapp/nativeui/traing/src/TraingWinView.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingWinView.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingWinView.h index 9f8d8a5b6..0fc9d8fda 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingWinView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingWinView.h @@ -38,7 +38,7 @@ namespace OHOS void InitView(); void DeInit(); - void InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId); + void InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId,int time); void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize); void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId); void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingWinView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingWinView.cpp index 56cedb7f8..6b16ccd90 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingWinView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingWinView.cpp @@ -163,9 +163,10 @@ namespace OHOS * @param width 视图的宽度。 * @param height 视图的高度。 * @param viewId 视图的ID。 + * @param time 视图的帧速 * @return 如果初始化成功则返回true,否则返回false。 */ - void TraingWinView::InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId) + void TraingWinView::InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId, int time) { if (imageAnimator == nullptr) { @@ -188,8 +189,8 @@ namespace OHOS imageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; } - imageAnimator->SetImageAnimatorSrc(imageAnimatorInfo, numFrames, 10); // 200 is the default delay time - imageAnimator->SetTimeOfPause(10); + imageAnimator->SetImageAnimatorSrc(imageAnimatorInfo, numFrames, time); // 200 is the default delay time + imageAnimator->SetTimeOfPause(time); imageAnimator->SetRepeatTimes(1); imageAnimator->SetReverse(true); imageAnimator->SetVisible(true); @@ -226,9 +227,9 @@ namespace OHOS const char *basePath = "/user/res/Training/win/"; const char *fileExtension = "bin"; const char **imagePaths = CreateImagePathsArray(basePath, fileExtension, 94); - InitImageAnimatorSource(imageAnimator, imagePaths, 94, 173, 100, 120, 120, "imageAnimator1"); + InitImageAnimatorSource(imageAnimator, imagePaths, 94, 173, 100, 120, 120, "imageAnimator1", 10); container_->Add(imageAnimator); - //FreeImagePathsArray(imagePaths, 94); //删除数组,释放内存 + // FreeImagePathsArray(imagePaths, 94); //删除数组,释放内存 // 初始化Button InitButton(button1_, 0, 366, 466, 100, BUTTONOK); -- 2.17.1