Ionic animation with wbe-animation

#1
animations:[
		trigger('fadeUp', [
      state('fadeUped', style({
				top:'45%',
				left:'20%',
				width:'60%'
			}))
	
      transition('* <=> fadeUped',animate('600ms ease')),
			transition('* <=> fadeUp320',animate('600ms ease'))
    ])
		
	]

first of all, sorry 4 my english QAQ
I used web-animation to do an animation, I use the top value to control the animation up or down, in the iphone6s screen, it is perfect, but in the iphone4 screen, is a small screen, I set the top value may not be so perfect So I did a compatibility;like this

First, I added an animation state for 320 screen,

	state('fadeUp320', style({
				top:'55%',
				left:'20%',
				width:'60%'
			})),

then

	toggleFlip(){
				let wip4 = window.innerWidth;
				let hip4 = window.innerHeight;
				if(wip4==320 && hip4==480 ){
					this.fadeState=(this.fadeState == 'fadeDown') ? 'fadeUp320' : 'fadeDown';
				}else{
					this.fadeState = (this.fadeState == 'fadeDown') ? 'fadeUped' : 'fadeDown';
				}
			}

I use IF to determine the width of the screen and i did it。

I know that this may not be the best way, so I would like to ask there is a better way to do it