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

Method loadAnimation

core/src/components/menu/menu.tsx:494–520  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

492 }
493
494 private async loadAnimation(): Promise<void> {
495 // Menu swipe animation takes the menu's inner width as parameter,
496 // If `offsetWidth` changes, we need to create a new animation.
497 const width = this.menuInnerEl!.offsetWidth;
498 /**
499 * Menu direction animation is calculated based on the document direction.
500 * If the document direction changes, we need to create a new animation.
501 */
502 const isEndSide = isEnd(this.side);
503 if (width === this.width && this.animation !== undefined && isEndSide === this.isEndSide) {
504 return;
505 }
506 this.width = width;
507 this.isEndSide = isEndSide;
508
509 // Destroy existing animation
510 if (this.animation) {
511 this.animation.destroy();
512 this.animation = undefined;
513 }
514 // Create new animation
515 const animation = (this.animation = await menuController._createAnimation(this.type!, this));
516 if (!config.getBoolean('animated', true)) {
517 animation.duration(0);
518 }
519 animation.fill('both');
520 }
521
522 private async startAnimation(shouldOpen: boolean, animated: boolean): Promise<void> {
523 const isReversed = !shouldOpen;

Callers 2

_setOpenMethod · 0.95
onWillStartMethod · 0.95

Calls 5

durationMethod · 0.80
fillMethod · 0.80
destroyMethod · 0.65
_createAnimationMethod · 0.65
getBooleanMethod · 0.45

Tested by

no test coverage detected