(shouldOpen: boolean, animated: boolean)
| 520 | } |
| 521 | |
| 522 | private async startAnimation(shouldOpen: boolean, animated: boolean): Promise<void> { |
| 523 | const isReversed = !shouldOpen; |
| 524 | const mode = getIonMode(this); |
| 525 | const easing = mode === 'ios' ? iosEasing : mdEasing; |
| 526 | const easingReverse = mode === 'ios' ? iosEasingReverse : mdEasingReverse; |
| 527 | const ani = (this.animation as Animation)! |
| 528 | .direction(isReversed ? 'reverse' : 'normal') |
| 529 | .easing(isReversed ? easingReverse : easing); |
| 530 | |
| 531 | if (animated) { |
| 532 | await ani.play(); |
| 533 | } else { |
| 534 | ani.play({ sync: true }); |
| 535 | } |
| 536 | |
| 537 | /** |
| 538 | * We run this after the play invocation |
| 539 | * instead of using ani.onFinish so that |
| 540 | * multiple onFinish callbacks do not get |
| 541 | * run if an animation is played, stopped, |
| 542 | * and then played again. |
| 543 | */ |
| 544 | if (ani.getDirection() === 'reverse') { |
| 545 | ani.direction('normal'); |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | private _isActive() { |
| 550 | return !this.disabled && !this.isPaneVisible; |
no test coverage detected