1 | import { Transition } from '.';
|
2 | export class FadeTransition extends Transition {
|
3 | createAndroidAnimator(transitionType) {
|
4 | const animatorSet = new android.animation.AnimatorSet();
|
5 | const alphaValues = Array.create('float', 2);
|
6 | switch (transitionType) {
|
7 | case Transition.AndroidTransitionType.enter:
|
8 | case Transition.AndroidTransitionType.popEnter:
|
9 | alphaValues[0] = 0;
|
10 | alphaValues[1] = 1;
|
11 | break;
|
12 | case Transition.AndroidTransitionType.exit:
|
13 | case Transition.AndroidTransitionType.popExit:
|
14 | alphaValues[0] = 1;
|
15 | alphaValues[1] = 0;
|
16 | break;
|
17 | }
|
18 | const animator = android.animation.ObjectAnimator.ofFloat(null, 'alpha', alphaValues);
|
19 | const duration = this.getDuration();
|
20 | if (duration !== undefined) {
|
21 | animator.setDuration(duration);
|
22 | }
|
23 | animator.setInterpolator(this.getCurve());
|
24 | animatorSet.play(animator);
|
25 | return animatorSet;
|
26 | }
|
27 | }
|
28 |
|
\ | No newline at end of file |