@ionic/core
Version:
Base components for Ionic
29 lines (28 loc) • 976 B
JavaScript
import { baseAnimation } from './base';
export function menuPushAnimation(AnimationC, _, menu) {
let contentOpenedX;
let menuClosedX;
const width = menu.width;
if (menu.isEndSide) {
contentOpenedX = -width + 'px';
menuClosedX = width + 'px';
}
else {
contentOpenedX = width + 'px';
menuClosedX = -width + 'px';
}
const menuAnimation = new AnimationC()
.addElement(menu.menuInnerEl)
.fromTo('translateX', menuClosedX, '0px');
const contentAnimation = new AnimationC()
.addElement(menu.contentEl)
.fromTo('translateX', '0px', contentOpenedX);
const backdropAnimation = new AnimationC()
.addElement(menu.backdropEl)
.fromTo('opacity', 0.01, 0.32);
return baseAnimation(AnimationC).then(animation => {
return animation.add(menuAnimation)
.add(backdropAnimation)
.add(contentAnimation);
});
}