Bladeren bron

Apply easing on shared element bounds transformation (#1098)

Apply easing on shared element bounds transformation
Guy Carmeli 7 jaren geleden
bovenliggende
commit
d5fb1729db

+ 6
- 4
android/app/src/main/java/com/reactnativenavigation/views/sharedElementTransition/SharedElementAnimatorCreator.java Bestand weergeven

@@ -62,7 +62,7 @@ class SharedElementAnimatorCreator {
62 62
             result.add(createColorAnimator(resolver, params.duration));
63 63
         }
64 64
         if (shouldAddImageClipBoundsAnimator(params)) {
65
-            result.add(createImageClipBoundsAnimator(resolver, params.duration));
65
+            result.add(createImageClipBoundsAnimator(resolver, params));
66 66
             result.add(createImageTransformAnimator(resolver, params));
67 67
         }
68 68
         return result;
@@ -152,14 +152,16 @@ class SharedElementAnimatorCreator {
152 152
                 .setDuration(duration);
153 153
     }
154 154
 
155
-    private ObjectAnimator createImageClipBoundsAnimator(AnimatorValuesResolver resolver, int duration) {
156
-        return ObjectAnimator.ofObject(
155
+    private ObjectAnimator createImageClipBoundsAnimator(AnimatorValuesResolver resolver, SharedElementTransitionParams params) {
156
+        ObjectAnimator animator = ObjectAnimator.ofObject(
157 157
                 to,
158 158
                 "clipBounds",
159 159
                 new ClipBoundsEvaluator(),
160 160
                 resolver.startDrawingRect,
161 161
                 resolver.endDrawingRect)
162
-                .setDuration(duration);
162
+                .setDuration(params.duration);
163
+        animator.setInterpolator(params.interpolation.easing.getInterpolator());
164
+        return animator;
163 165
     }
164 166
     private Animator createImageTransformAnimator(AnimatorValuesResolver resolver, SharedElementTransitionParams params) {
165 167
         ScalingUtils.InterpolatingScaleType ist = new ScalingUtils.InterpolatingScaleType(