2017-08-24 08:13:12 +00:00
|
|
|
import { sequence, trigger, stagger, animate, style, group, query, transition, keyframes, animateChild, state } from '@angular/animations';
|
2017-08-19 13:20:09 +00:00
|
|
|
|
2017-08-24 08:13:12 +00:00
|
|
|
// const query = (s, a, o = {optional: true}) => q(s, a, o);
|
2017-07-10 02:59:30 +00:00
|
|
|
|
|
|
|
export class Animations
|
|
|
|
{
|
|
|
|
public static slideInOut = trigger('slideInOut', [
|
2017-08-02 16:51:02 +00:00
|
|
|
state('0', style({
|
|
|
|
height : '0px',
|
|
|
|
display: 'none'
|
|
|
|
})),
|
|
|
|
state('1', style({
|
|
|
|
height : '*',
|
|
|
|
display: 'block'
|
|
|
|
})),
|
2017-07-10 02:59:30 +00:00
|
|
|
transition('1 => 0', animate('300ms ease-out')),
|
|
|
|
transition('0 => 1', animate('300ms ease-in'))
|
|
|
|
]);
|
2017-08-02 16:51:02 +00:00
|
|
|
|
2017-07-23 07:32:13 +00:00
|
|
|
public static slideInLeft = trigger('slideInLeft', [
|
2017-08-02 16:51:02 +00:00
|
|
|
state('void', style({
|
|
|
|
transform: 'translateX(-100%)',
|
|
|
|
display : 'none'
|
|
|
|
})),
|
|
|
|
state('*', style({
|
|
|
|
transform: 'translateX(0)',
|
|
|
|
display : 'flex'
|
|
|
|
})),
|
2017-07-23 07:32:13 +00:00
|
|
|
transition('void => *', animate('300ms')),
|
|
|
|
transition('* => void', animate('300ms'))
|
|
|
|
]);
|
2017-08-02 16:51:02 +00:00
|
|
|
|
2017-07-23 07:32:13 +00:00
|
|
|
public static slideInRight = trigger('slideInRight', [
|
2017-08-02 16:51:02 +00:00
|
|
|
state('void', style({
|
|
|
|
transform: 'translateX(100%)',
|
|
|
|
display : 'none'
|
|
|
|
})),
|
|
|
|
state('*', style({
|
|
|
|
transform: 'translateX(0)',
|
|
|
|
display : 'flex'
|
|
|
|
})),
|
|
|
|
transition('void => *', animate('300ms')),
|
|
|
|
transition('* => void', animate('300ms'))
|
|
|
|
]);
|
|
|
|
|
|
|
|
public static slideInTop = trigger('slideInTop', [
|
|
|
|
state('void', style({
|
|
|
|
transform: 'translateY(-100%)',
|
|
|
|
display : 'none'
|
|
|
|
})),
|
|
|
|
state('*', style({
|
|
|
|
transform: 'translateY(0)',
|
|
|
|
display : 'flex'
|
|
|
|
})),
|
|
|
|
transition('void => *', animate('300ms')),
|
|
|
|
transition('* => void', animate('300ms'))
|
|
|
|
]);
|
|
|
|
|
|
|
|
public static slideInBottom = trigger('slideInBottom', [
|
2017-08-19 13:20:09 +00:00
|
|
|
state('void',
|
|
|
|
style({
|
|
|
|
transform: 'translateY(100%)',
|
|
|
|
display : 'none'
|
|
|
|
})),
|
2017-08-02 16:51:02 +00:00
|
|
|
state('*', style({
|
|
|
|
transform: 'translateY(0)',
|
|
|
|
display : 'flex'
|
|
|
|
})),
|
2017-07-23 07:32:13 +00:00
|
|
|
transition('void => *', animate('300ms')),
|
|
|
|
transition('* => void', animate('300ms'))
|
|
|
|
]);
|
2017-08-19 13:20:09 +00:00
|
|
|
|
2017-08-23 14:28:15 +00:00
|
|
|
public static routerTransitionLeft = trigger('routerTransitionLeft', [
|
2017-08-19 13:20:09 +00:00
|
|
|
|
|
|
|
transition('* => *', [
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :enter, fuse-content > :leave', [
|
|
|
|
style({
|
|
|
|
position: 'absolute',
|
|
|
|
top : 0,
|
|
|
|
bottom : 0,
|
|
|
|
left : 0,
|
|
|
|
right : 0
|
|
|
|
})
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :enter', [
|
|
|
|
style({
|
|
|
|
transform: 'translateX(100%)',
|
|
|
|
opacity : 0
|
|
|
|
})
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-19 13:20:09 +00:00
|
|
|
sequence([
|
|
|
|
group([
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :leave', [
|
|
|
|
style({
|
|
|
|
transform: 'translateX(0)',
|
|
|
|
opacity : 1
|
|
|
|
}),
|
|
|
|
animate('400ms cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
|
|
style({
|
|
|
|
transform: 'translateX(-100%)',
|
|
|
|
opacity : 0
|
|
|
|
}))
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :enter', [
|
|
|
|
style({transform: 'translateX(100%)'}),
|
|
|
|
animate('400ms cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
|
|
style({
|
|
|
|
transform: 'translateX(0%)',
|
|
|
|
opacity : 1
|
|
|
|
}))
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true})
|
2017-08-23 14:28:15 +00:00
|
|
|
]),
|
2017-08-24 08:13:12 +00:00
|
|
|
query('fuse-content > :leave', animateChild(), {optional: true}),
|
|
|
|
query('fuse-content > :enter', animateChild(), {optional: true})
|
2017-08-23 14:28:15 +00:00
|
|
|
])
|
|
|
|
])
|
|
|
|
]);
|
|
|
|
|
|
|
|
public static routerTransitionRight = trigger('routerTransitionRight', [
|
|
|
|
|
|
|
|
transition('* => *', [
|
|
|
|
query('fuse-content > :enter, fuse-content > :leave', [
|
|
|
|
style({
|
|
|
|
position: 'absolute',
|
|
|
|
top : 0,
|
|
|
|
bottom : 0,
|
|
|
|
left : 0,
|
|
|
|
right : 0
|
|
|
|
})
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :enter', [
|
|
|
|
style({
|
|
|
|
transform: 'translateX(-100%)',
|
|
|
|
opacity : 0
|
|
|
|
})
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
sequence([
|
|
|
|
group([
|
|
|
|
query('fuse-content > :leave', [
|
|
|
|
style({
|
|
|
|
transform: 'translateX(0)',
|
|
|
|
opacity : 1
|
|
|
|
}),
|
|
|
|
animate('400ms cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
|
|
style({
|
|
|
|
transform: 'translateX(100%)',
|
|
|
|
opacity : 0
|
|
|
|
}))
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :enter', [
|
|
|
|
style({transform: 'translateX(-100%)'}),
|
|
|
|
animate('400ms cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
|
|
style({
|
|
|
|
transform: 'translateX(0%)',
|
|
|
|
opacity : 1
|
|
|
|
}))
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true})
|
2017-08-23 14:28:15 +00:00
|
|
|
]),
|
2017-08-24 08:13:12 +00:00
|
|
|
query('fuse-content > :leave', animateChild(), {optional: true}),
|
|
|
|
query('fuse-content > :enter', animateChild(), {optional: true})
|
2017-08-23 14:28:15 +00:00
|
|
|
])
|
|
|
|
])
|
|
|
|
]);
|
|
|
|
|
|
|
|
public static routerTransitionUp = trigger('routerTransitionUp', [
|
|
|
|
|
|
|
|
transition('* => *', [
|
|
|
|
query('fuse-content > :enter, fuse-content > :leave', [
|
|
|
|
style({
|
|
|
|
position: 'absolute',
|
|
|
|
top : 0,
|
|
|
|
bottom : 0,
|
|
|
|
left : 0,
|
|
|
|
right : 0
|
|
|
|
})
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :enter', [
|
|
|
|
style({
|
|
|
|
transform: 'translateY(100%)',
|
|
|
|
opacity : 0
|
|
|
|
})
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
sequence([
|
|
|
|
group([
|
|
|
|
query('fuse-content > :leave', [
|
2017-08-19 13:20:09 +00:00
|
|
|
style({
|
|
|
|
transform: 'translateY(0)',
|
|
|
|
opacity : 1
|
|
|
|
}),
|
|
|
|
animate('400ms cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
|
|
style({
|
|
|
|
transform: 'translateY(-100%)',
|
|
|
|
opacity : 0
|
|
|
|
}))
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :enter', [
|
2017-08-19 13:20:09 +00:00
|
|
|
style({transform: 'translateY(100%)'}),
|
|
|
|
animate('400ms cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
|
|
style({
|
|
|
|
transform: 'translateY(0%)',
|
|
|
|
opacity : 1
|
|
|
|
}))
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true})
|
2017-08-19 13:20:09 +00:00
|
|
|
]),
|
2017-08-24 08:13:12 +00:00
|
|
|
query('fuse-content > :leave', animateChild(), {optional: true}),
|
|
|
|
query('fuse-content > :enter', animateChild(), {optional: true})
|
2017-08-23 14:28:15 +00:00
|
|
|
])
|
|
|
|
])
|
|
|
|
]);
|
|
|
|
|
|
|
|
public static routerTransitionDown = trigger('routerTransitionDown', [
|
|
|
|
|
|
|
|
transition('* => *', [
|
|
|
|
query('fuse-content > :enter, fuse-content > :leave', [
|
|
|
|
style({
|
|
|
|
position: 'absolute',
|
|
|
|
top : 0,
|
|
|
|
bottom : 0,
|
|
|
|
left : 0,
|
|
|
|
right : 0
|
|
|
|
})
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :enter', [
|
|
|
|
style({
|
|
|
|
transform: 'translateY(-100%)',
|
|
|
|
opacity : 0
|
|
|
|
})
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
sequence([
|
|
|
|
group([
|
|
|
|
query('fuse-content > :leave', [
|
|
|
|
style({
|
|
|
|
transform: 'translateY(0)',
|
|
|
|
opacity : 1
|
|
|
|
}),
|
|
|
|
animate('400ms cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
|
|
style({
|
|
|
|
transform: 'translateY(100%)',
|
|
|
|
opacity : 0
|
|
|
|
}))
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :enter', [
|
|
|
|
style({transform: 'translateY(-100%)'}),
|
|
|
|
animate('400ms cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
|
|
style({
|
|
|
|
transform: 'translateY(0%)',
|
|
|
|
opacity : 1
|
|
|
|
}))
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true})
|
2017-08-23 14:28:15 +00:00
|
|
|
]),
|
2017-08-24 08:13:12 +00:00
|
|
|
query('fuse-content > :leave', animateChild(), {optional: true}),
|
|
|
|
query('fuse-content > :enter', animateChild(), {optional: true})
|
2017-08-19 13:20:09 +00:00
|
|
|
])
|
|
|
|
])
|
|
|
|
]);
|
2017-08-23 14:28:15 +00:00
|
|
|
|
|
|
|
public static routerTransitionFade = trigger('routerTransitionFade', [
|
|
|
|
|
|
|
|
transition('* => *', [
|
|
|
|
|
|
|
|
query('fuse-content > :enter, fuse-content > :leave ', [
|
|
|
|
style({
|
|
|
|
position: 'absolute',
|
|
|
|
top : 0,
|
|
|
|
bottom : 0,
|
|
|
|
left : 0,
|
|
|
|
right : 0
|
|
|
|
})
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :enter', [
|
|
|
|
style({
|
|
|
|
opacity: 0
|
|
|
|
})
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
|
|
|
// sequence([
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :leave', [
|
|
|
|
style({
|
|
|
|
opacity: 1
|
|
|
|
}),
|
|
|
|
animate('300ms cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
|
|
style({
|
|
|
|
opacity: 0
|
|
|
|
}))
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
2017-08-23 14:28:15 +00:00
|
|
|
query('fuse-content > :enter', [
|
|
|
|
style({
|
|
|
|
opacity: 0
|
|
|
|
}),
|
|
|
|
animate('300ms cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
|
|
|
style({
|
|
|
|
opacity: 1
|
|
|
|
}))
|
2017-08-24 08:13:12 +00:00
|
|
|
], {optional: true}),
|
|
|
|
// ]),
|
|
|
|
query('fuse-content > :enter', animateChild(), {optional: true}),
|
|
|
|
query('fuse-content > :leave', animateChild(), {optional: true})
|
2017-08-23 14:28:15 +00:00
|
|
|
])
|
|
|
|
]);
|
2017-07-10 02:59:30 +00:00
|
|
|
}
|