From b770cc2a8bd637dd8dd68a8c719bc7a4f18053bf Mon Sep 17 00:00:00 2001 From: 251309-lirui Date: Mon, 5 Jul 2021 11:14:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 4 +- .../cananimation/CanFlipAnimation.java | 110 +++++++++--------- .../cananimation/FlipAnimation.java | 78 ++++++------- 3 files changed, 96 insertions(+), 96 deletions(-) diff --git a/build.gradle b/build.gradle index 5e5cfbe..5a78bee 100644 --- a/build.gradle +++ b/build.gradle @@ -19,8 +19,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.huawei.ohos:hap:2.4.4.2' - classpath 'com.huawei.ohos:decctest:1.0.0.6' + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' } } diff --git a/cananimation/src/main/java/com/canyinghao/cananimation/CanFlipAnimation.java b/cananimation/src/main/java/com/canyinghao/cananimation/CanFlipAnimation.java index 06a1891..09cbcd5 100644 --- a/cananimation/src/main/java/com/canyinghao/cananimation/CanFlipAnimation.java +++ b/cananimation/src/main/java/com/canyinghao/cananimation/CanFlipAnimation.java @@ -1,54 +1,54 @@ -//package com.canyinghao.cananimation; -// -//import ohos.agp.animation.Animator; -//import ohos.agp.components.Component; -// -//public class CanFlipAnimation { -// -// -// public enum FlipDirection { -// LEFT_RIGHT, -// RIGHT_LEFT, -// TOP_BOTTOM, -// BOTTOM_TOP; -// -// public float getStartDegreeForFirstView() { -// return 0; -// } -// -// public float getStartDegreeForSecondView() { -// switch (this) { -// case LEFT_RIGHT: -// case TOP_BOTTOM: -// return -90; -// case RIGHT_LEFT: -// case BOTTOM_TOP: -// return 90; -// default: -// return 0; -// } -// } -// -// public float getEndDegreeForFirstView() { -// switch (this) { -// case LEFT_RIGHT: -// case TOP_BOTTOM: -// return 90; -// case RIGHT_LEFT: -// case BOTTOM_TOP: -// return -90; -// default: -// return 0; -// } -// } -// -// public float getEndDegreeForSecondView() { -// return 0; -// } -// -// -// } -// +package com.canyinghao.cananimation; + +import ohos.agp.animation.Animator; +import ohos.agp.components.Component; + +public class CanFlipAnimation { + + + public enum FlipDirection { + LEFT_RIGHT, + RIGHT_LEFT, + TOP_BOTTOM, + BOTTOM_TOP; + + public float getStartDegreeForFirstView() { + return 0; + } + + public float getStartDegreeForSecondView() { + switch (this) { + case LEFT_RIGHT: + case TOP_BOTTOM: + return -90; + case RIGHT_LEFT: + case BOTTOM_TOP: + return 90; + default: + return 0; + } + } + + public float getEndDegreeForFirstView() { + switch (this) { + case LEFT_RIGHT: + case TOP_BOTTOM: + return 90; + case RIGHT_LEFT: + case BOTTOM_TOP: + return -90; + default: + return 0; + } + } + + public float getEndDegreeForSecondView() { + return 0; + } + + + } + // private static Animation[] flipAnim(final Component fromView, FlipDirection dir, long duration, Interpolator interpolator, float scale) { // Animation[] result = new Animation[2]; // float centerX; @@ -105,7 +105,7 @@ // return animations; // } // -// + // /** // * 翻转动画翻转一定次数 // * @@ -182,10 +182,10 @@ // // // } -// + // public static void flipForever(final ViewAnimator viewAnimator, final FlipDirection dir, final long duration, final Interpolator interpolator, final float scale) { // // flipRepeat(0, viewAnimator, dir, duration, interpolator, scale); // } -// -//} + +} diff --git a/cananimation/src/main/java/com/canyinghao/cananimation/FlipAnimation.java b/cananimation/src/main/java/com/canyinghao/cananimation/FlipAnimation.java index 6cec35f..93605a8 100644 --- a/cananimation/src/main/java/com/canyinghao/cananimation/FlipAnimation.java +++ b/cananimation/src/main/java/com/canyinghao/cananimation/FlipAnimation.java @@ -1,40 +1,40 @@ -//package com.canyinghao.cananimation; -// -//import ohos.agp.animation.Animator; -//import ohos.agp.animation.AnimatorProperty; -//import ohos.agp.render.render3d.components.CameraComponent; -//import ohos.agp.transition.Transition; -//import ohos.agp.transition.TransitionComponents; -//import ohos.agp.utils.Matrix; -//import ohos.media.camera.device.Camera; -// -//public class FlipAnimation extends Animator { -// -// private float mFromDegrees; -// private float mToDegrees; -// private CameraComponent mCamera; -// private float mCenterX; -// private float mCenterY; -// private boolean mIsX; -// private float mScale; -// -// -// public FlipAnimation(float fromDegrees, float toDegrees, float centerX, float centerY, float scale) { -// mFromDegrees = fromDegrees; -// mToDegrees = toDegrees; -// mCenterX = centerX; -// mCenterY = centerY; -// mScale = scale; -// if (mScale <= 0) { -// mScale = 1; -// } -// } -// -// -// public void setIsX(boolean isX) { -// this.mIsX = isX; -// } -// +package com.canyinghao.cananimation; + +import ohos.agp.animation.Animator; +import ohos.agp.animation.AnimatorProperty; +import ohos.agp.render.render3d.components.CameraComponent; +import ohos.agp.transition.Transition; +import ohos.agp.transition.TransitionComponents; +import ohos.agp.utils.Matrix; +import ohos.media.camera.device.Camera; + +public class FlipAnimation extends Animator { + + private float mFromDegrees; + private float mToDegrees; + private CameraComponent mCamera; + private float mCenterX; + private float mCenterY; + private boolean mIsX; + private float mScale; + + + public FlipAnimation(float fromDegrees, float toDegrees, float centerX, float centerY, float scale) { + mFromDegrees = fromDegrees; + mToDegrees = toDegrees; + mCenterX = centerX; + mCenterY = centerY; + mScale = scale; + if (mScale <= 0) { + mScale = 1; + } + } + + + public void setIsX(boolean isX) { + this.mIsX = isX; + } + // @Override // public void initialize(int width, int height, int parentWidth, int parentHeight) { // super.initialize(width, height, parentWidth, parentHeight); @@ -72,5 +72,5 @@ // // // } -// -//} + +} -- Gitee