MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / startAnimation

Method startAnimation

core/src/components/menu/menu.tsx:522–547  ·  view source on GitHub ↗
(shouldOpen: boolean, animated: boolean)

Source from the content-addressed store, hash-verified

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;

Callers 1

_setOpenMethod · 0.95

Calls 5

getIonModeFunction · 0.90
easingMethod · 0.80
directionMethod · 0.80
playMethod · 0.80
getDirectionMethod · 0.65

Tested by

no test coverage detected