mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
refactor(animation): update animation API (#19529)
This commit is contained in:
@ -29,11 +29,11 @@ export const menuOverlayAnimation = (menu: MenuI): IonicAnimation => {
|
||||
}
|
||||
|
||||
menuAnimation
|
||||
.addElement(menu.menuInnerEl)
|
||||
.addElement(menu.menuInnerEl!)
|
||||
.fromTo('transform', `translateX(${closedX})`, `translateX(${openedX})`);
|
||||
|
||||
backdropAnimation
|
||||
.addElement(menu.backdropEl)
|
||||
.addElement(menu.backdropEl!)
|
||||
.fromTo('opacity', 0.01, 0.32);
|
||||
|
||||
return baseAnimation().addAnimation([menuAnimation, backdropAnimation]);
|
||||
|
||||
@ -24,15 +24,15 @@ export const menuPushAnimation = (menu: MenuI): IonicAnimation => {
|
||||
}
|
||||
|
||||
const menuAnimation = createAnimation()
|
||||
.addElement(menu.menuInnerEl)
|
||||
.addElement(menu.menuInnerEl!)
|
||||
.fromTo('transform', `translateX(${menuClosedX})`, 'translateX(0px)');
|
||||
|
||||
const contentAnimation = createAnimation()
|
||||
.addElement(menu.contentEl)
|
||||
.addElement(menu.contentEl!)
|
||||
.fromTo('transform', 'translateX(0px)', `translateX(${contentOpenedX})`);
|
||||
|
||||
const backdropAnimation = createAnimation()
|
||||
.addElement(menu.backdropEl)
|
||||
.addElement(menu.backdropEl!)
|
||||
.fromTo('opacity', 0.01, 0.32);
|
||||
|
||||
return baseAnimation().addAnimation([menuAnimation, backdropAnimation, contentAnimation]);
|
||||
|
||||
@ -12,7 +12,7 @@ export const menuRevealAnimation = (menu: MenuI): IonicAnimation => {
|
||||
const openedX = (menu.width * (menu.isEndSide ? -1 : 1)) + 'px';
|
||||
|
||||
const contentOpen = createAnimation()
|
||||
.addElement(menu.contentEl)
|
||||
.addElement(menu.contentEl!) // REVIEW
|
||||
.fromTo('transform', 'translateX(0px)', `translateX(${openedX})`);
|
||||
|
||||
return baseAnimation().addAnimation(contentOpen);
|
||||
|
||||
@ -165,7 +165,7 @@ const createMenuController = () => {
|
||||
return menu._setOpen(shouldOpen, animated);
|
||||
};
|
||||
|
||||
const _createAnimation = (type: string, menuCmp: MenuI): Promise<any> => {
|
||||
const _createAnimation = (type: string, menuCmp: MenuI) => {
|
||||
const animationBuilder = menuAnimations.get(type) as any;
|
||||
if (!animationBuilder) {
|
||||
throw new Error('animation not registered');
|
||||
|
||||
Reference in New Issue
Block a user