Browse Source

Apply easing on shared element bounds transformation (#1098)

Apply easing on shared element bounds transformation
Guy Carmeli 7 years ago
parent
commit
d5fb1729db

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

62
             result.add(createColorAnimator(resolver, params.duration));
62
             result.add(createColorAnimator(resolver, params.duration));
63
         }
63
         }
64
         if (shouldAddImageClipBoundsAnimator(params)) {
64
         if (shouldAddImageClipBoundsAnimator(params)) {
65
-            result.add(createImageClipBoundsAnimator(resolver, params.duration));
65
+            result.add(createImageClipBoundsAnimator(resolver, params));
66
             result.add(createImageTransformAnimator(resolver, params));
66
             result.add(createImageTransformAnimator(resolver, params));
67
         }
67
         }
68
         return result;
68
         return result;
152
                 .setDuration(duration);
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
                 to,
157
                 to,
158
                 "clipBounds",
158
                 "clipBounds",
159
                 new ClipBoundsEvaluator(),
159
                 new ClipBoundsEvaluator(),
160
                 resolver.startDrawingRect,
160
                 resolver.startDrawingRect,
161
                 resolver.endDrawingRect)
161
                 resolver.endDrawingRect)
162
-                .setDuration(duration);
162
+                .setDuration(params.duration);
163
+        animator.setInterpolator(params.interpolation.easing.getInterpolator());
164
+        return animator;
163
     }
165
     }
164
     private Animator createImageTransformAnimator(AnimatorValuesResolver resolver, SharedElementTransitionParams params) {
166
     private Animator createImageTransformAnimator(AnimatorValuesResolver resolver, SharedElementTransitionParams params) {
165
         ScalingUtils.InterpolatingScaleType ist = new ScalingUtils.InterpolatingScaleType(
167
         ScalingUtils.InterpolatingScaleType ist = new ScalingUtils.InterpolatingScaleType(