diff --git a/android/titanium/src/java/org/appcelerator/titanium/util/TiAnimationBuilder.java b/android/titanium/src/java/org/appcelerator/titanium/util/TiAnimationBuilder.java index 32ed3fc6957..c3d184aa0a7 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/util/TiAnimationBuilder.java +++ b/android/titanium/src/java/org/appcelerator/titanium/util/TiAnimationBuilder.java @@ -117,7 +117,8 @@ public class TiAnimationBuilder protected String width = null, height = null; protected Integer backgroundColor = null; protected Integer color = null; - protected float rotationY, rotationX = -1; + private float INITIAL_ROTATION = 999999f; + protected float rotationY, rotationX, rotation = INITIAL_ROTATION; protected TiAnimationCurve curve = TiAnimationBuilder.DEFAULT_CURVE; protected TiAnimation animationProxy; @@ -245,11 +246,15 @@ public void applyOptions(HashMap options) } if (options.containsKey(TiC.PROPERTY_ROTATION_Y)) { - rotationY = TiConvert.toFloat(options, TiC.PROPERTY_ROTATION_Y, -1); + rotationY = TiConvert.toFloat(options, TiC.PROPERTY_ROTATION_Y, INITIAL_ROTATION); } if (options.containsKey(TiC.PROPERTY_ROTATION_X)) { - rotationX = TiConvert.toFloat(options, TiC.PROPERTY_ROTATION_X, -1); + rotationX = TiConvert.toFloat(options, TiC.PROPERTY_ROTATION_X, INITIAL_ROTATION); + } + + if (options.containsKey(TiC.PROPERTY_ROTATION)) { + rotation = TiConvert.toFloat(options, TiC.PROPERTY_ROTATION, INITIAL_ROTATION); } this.options = options; } @@ -313,12 +318,15 @@ private AnimatorSet buildPropertyAnimators(int x, int y, int w, int h, int paren addAnimator(animators, ObjectAnimator.ofFloat(view, "elevation", elevation)); } - if (rotationY >= 0) { + if (rotationY != INITIAL_ROTATION) { addAnimator(animators, ObjectAnimator.ofFloat(view, "rotationY", rotationY)); } - if (rotationX >= 0) { + if (rotationX != INITIAL_ROTATION) { addAnimator(animators, ObjectAnimator.ofFloat(view, "rotationX", rotationX)); } + if (rotation != INITIAL_ROTATION) { + addAnimator(animators, ObjectAnimator.ofFloat(view, "rotation", rotation)); + } if (backgroundColor != null) { View bgView = view; diff --git a/apidoc/Titanium/UI/Animation.yml b/apidoc/Titanium/UI/Animation.yml index 1a035486fd9..18a72ad7137 100644 --- a/apidoc/Titanium/UI/Animation.yml +++ b/apidoc/Titanium/UI/Animation.yml @@ -131,6 +131,12 @@ properties: summary: Duration of the animation, in milliseconds. type: Number + - name: rotation + summary: Value of the `rotation` property at the end of the animation. + type: Number + platforms: [android] + since: { android: "12.6.0" } + - name: rotationY summary: Value of the `rotationY` property at the end of the animation. type: Number