refactor(animation): update animation API (#19529)

This commit is contained in:
Manu MA
2019-10-02 19:52:46 +02:00
committed by GitHub
parent 71b8853ff4
commit f4818a1f3a
35 changed files with 481 additions and 437 deletions

View File

@ -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]);

View File

@ -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]);

View File

@ -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);

View File

@ -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');