mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-04-18 22:32:34 +00:00
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { animate, state, style, transition, trigger } from '@angular/animations';
|
|
import { FuseAnimationCurves, FuseAnimationDurations } from '@fuse/animations/defaults';
|
|
|
|
// -----------------------------------------------------------------------------------------------------
|
|
// @ Expand / collapse
|
|
// -----------------------------------------------------------------------------------------------------
|
|
const expandCollapse = trigger('expandCollapse',
|
|
[
|
|
state('void, collapsed',
|
|
style({
|
|
height: '0'
|
|
})
|
|
),
|
|
|
|
state('*, expanded',
|
|
style('*')
|
|
),
|
|
|
|
// Prevent the transition if the state is false
|
|
transition('void <=> false, collapsed <=> false, expanded <=> false', []),
|
|
|
|
// Transition
|
|
transition('void <=> *, collapsed <=> expanded',
|
|
animate('{{timings}}'),
|
|
{
|
|
params: {
|
|
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
|
}
|
|
}
|
|
)
|
|
]
|
|
);
|
|
|
|
export { expandCollapse };
|