Skip to content

Commit 9a3ad11

Browse files
authored
Merge pull request #57 from abney317/master
expandRightOnEnter
2 parents 08b9cec + eea8439 commit 9a3ad11

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

lib/other/collapse.animation.ts

+35
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ const expand = animation(
8787
)
8888
);
8989

90+
const expandRight = animation(
91+
animate(
92+
'{{duration}}ms {{delay}}ms',
93+
keyframes([
94+
style({ width: '0', visibility: 'hidden', overflow: 'hidden', easing: 'ease-out', offset: 0 }),
95+
style({ width: AUTO_STYLE, visibility: AUTO_STYLE, overflow: 'hidden', easing: 'ease-out', offset: 1 })
96+
])
97+
)
98+
);
99+
90100
const fadeInExpand = animation(
91101
animate(
92102
'{{duration}}ms {{delay}}ms',
@@ -166,6 +176,31 @@ export function collapseOnLeaveAnimation(options?: IAnimationOptions): Animation
166176
]);
167177
}
168178

179+
export function expandRightOnEnterAnimation(options?: IAnimationOptions): AnimationTriggerMetadata {
180+
return trigger((options && options.anchor) || 'expandRightOnEnter', [
181+
transition(
182+
':enter',
183+
animation([
184+
style({ visibility: 'hidden' }),
185+
...(options && options.animateChildren === 'before' ? [query('@*', animateChild(), { optional: true })] : []),
186+
group([
187+
useAnimation(expandRight),
188+
...(!options || !options.animateChildren || options.animateChildren === 'together'
189+
? [query('@*', animateChild(), { optional: true })]
190+
: [])
191+
]),
192+
...(options && options.animateChildren === 'after' ? [query('@*', animateChild(), { optional: true })] : [])
193+
]),
194+
{
195+
params: {
196+
delay: (options && options.delay) || 0,
197+
duration: (options && options.duration) || DEFAULT_DURATION
198+
}
199+
}
200+
)
201+
]);
202+
}
203+
169204
export function fadeInExpandOnEnterAnimation(options?: IAnimationOptions): AnimationTriggerMetadata {
170205
return trigger((options && options.anchor) || 'fadeInExpandOnEnter', [
171206
transition(

0 commit comments

Comments
 (0)