From a0235a5b497fb1805ec4a240c2a78983f2171d8a Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 4 Mar 2016 12:45:48 -0600 Subject: [PATCH] chore(alert): tweak wp alert animation --- ionic/components/alert/alert.ts | 43 +++++++++++++++++++++++++++++++++ ionic/config/modes.ts | 4 +-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/ionic/components/alert/alert.ts b/ionic/components/alert/alert.ts index e8e4aee1b2..e24e9ec051 100644 --- a/ionic/components/alert/alert.ts +++ b/ionic/components/alert/alert.ts @@ -558,4 +558,47 @@ class AlertMdPopOut extends Transition { } Transition.register('alert-md-pop-out', AlertMdPopOut); + + +class AlertWpPopIn extends Transition { + constructor(enteringView: ViewController, leavingView: ViewController, opts: TransitionOptions) { + super(opts); + + let ele = enteringView.pageRef().nativeElement; + let backdrop = new Animation(ele.querySelector('.backdrop')); + let wrapper = new Animation(ele.querySelector('.alert-wrapper')); + + wrapper.fromTo('opacity', '0.01', '1').fromTo('scale', '1.3', '1'); + backdrop.fromTo('opacity', '0.01', '0.5'); + + this + .easing('cubic-bezier(0, 0, 0.05, 1)') + .duration(200) + .add(backdrop) + .add(wrapper); + } +} +Transition.register('alert-wp-pop-in', AlertWpPopIn); + + +class AlertWpPopOut extends Transition { + constructor(enteringView: ViewController, leavingView: ViewController, opts: TransitionOptions) { + super(opts); + + let ele = leavingView.pageRef().nativeElement; + let backdrop = new Animation(ele.querySelector('.backdrop')); + let wrapper = new Animation(ele.querySelector('.alert-wrapper')); + + wrapper.fromTo('opacity', '1', '0').fromTo('scale', '1', '1.3'); + backdrop.fromTo('opacity', '0.5', '0'); + + this + .easing('ease-out') + .duration(150) + .add(backdrop) + .add(wrapper); + } +} +Transition.register('alert-wp-pop-out', AlertWpPopOut); + let alertIds = -1; diff --git a/ionic/config/modes.ts b/ionic/config/modes.ts index e6a1c2a358..fc68ea79e8 100644 --- a/ionic/config/modes.ts +++ b/ionic/config/modes.ts @@ -70,8 +70,8 @@ Config.setModeConfig('wp', { actionSheetEnter: 'action-sheet-wp-slide-in', actionSheetLeave: 'action-sheet-wp-slide-out', - alertEnter: 'alert-md-pop-in', - alertLeave: 'alert-md-pop-out', + alertEnter: 'alert-wp-pop-in', + alertLeave: 'alert-wp-pop-out', backButtonText: '', backButtonIcon: 'ios-arrow-back',