Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit 63594da

Browse files
fix(FAB): Fix center leave and enter animations
1 parent 5899f9b commit 63594da

3 files changed

Lines changed: 38 additions & 58 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/core/src/lib/fab/fab.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<ion-fab *ngIf="visible" (@fabAnim.done)="fabAnimDone($event)" [@fabAnim]="{value: '*',params: params}"
1+
<ion-fab *ngIf="visible" (@fabAnim.done)="fabAnimDone($event)" [@fabAnim]="horizontal"
22
[ngClass]="[mode,horizontal,vertical]" [slot]="slot">
33
<fiv-loading-spinner [color]="spinColor" *ngIf="!extended && loading" (fivProgress)="rotate($event)" #spinner
44
(fivComplete)="fillAnimationDone()" class="spinner" [circleRadius]="30" [diameter]="68" [strokeWidth]="4"

projects/core/src/lib/fab/fab.component.ts

Lines changed: 36 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -43,41 +43,43 @@ import {
4343
styleUrls: ['./fab.component.scss'],
4444
animations: [
4545
trigger('fabAnim', [
46-
transition(
47-
'void => *',
48-
[
46+
transition('void => center', [
47+
style({
48+
transform: 'translateX(-50%) scale(0) '
49+
}),
50+
animate('250ms ease', style({ transform: 'translateX(-50%) scale(1)' }))
51+
]),
52+
transition('center => void', [
53+
style({
54+
transform: 'translateX(-50%) scale(1) '
55+
}),
56+
animate(
57+
'250ms ease',
58+
style({ transform: ' translateX(-50%) scale(0)' })
59+
)
60+
]),
61+
transition('void => *', [
62+
style({
63+
transform: 'scale(0)'
64+
}),
65+
animate(
66+
'250ms ease',
4967
style({
50-
transform: '{{fromTransform}}'
51-
}),
52-
animate(
53-
'250ms ease-out',
54-
style({
55-
transform: '{{toTransform}}'
56-
})
57-
)
58-
],
59-
{
60-
params: {
61-
fromTransform: 'scale(0) translateX(-50%)',
62-
toTransform: 'translateX(-50%) scale(1)'
63-
}
64-
}
65-
),
66-
transition(
67-
'* => void',
68-
[
68+
transform: 'scale(1)'
69+
})
70+
)
71+
]),
72+
transition('* => void', [
73+
style({
74+
transform: 'scale(1)'
75+
}),
76+
animate(
77+
'250ms ease',
6978
style({
70-
transform: '{{toTransform}}'
71-
}),
72-
animate('250ms ease-in', style({ transform: '{{fromTransform}}' }))
73-
],
74-
{
75-
params: {
76-
fromTransform: 'scale(0) translateX(-50%)',
77-
toTransform: 'translateX(-50%) scale(1)'
78-
}
79-
}
80-
)
79+
transform: 'scale(0)'
80+
})
81+
)
82+
])
8183
]),
8284
trigger('labelAnim', [
8385
transition('void => *', [
@@ -131,32 +133,10 @@ export class FivFab implements OnInit, OnDestroy, AfterContentInit {
131133
currentDeltaY = 0;
132134
$onDestroy = new Subject();
133135

134-
params: { fromTransform: string; toTransform: string } = {
135-
fromTransform: 'translateX(-50%) scale(0)',
136-
toTransform: 'translateX(-50%) scale(1)'
137-
};
138-
139-
get fromTransform() {
140-
return this.horizontal === 'center'
141-
? 'scale(0) translateX(-50%)'
142-
: 'scale(0)';
143-
}
144-
145-
get toTransform() {
146-
return this.horizontal === 'center'
147-
? 'translateX(-50%) scale(1)'
148-
: 'scale(1)';
149-
}
150-
151136
constructor(
152137
private renderer: Renderer2,
153138
@Optional() private content: IonContent
154-
) {
155-
this.params = {
156-
toTransform: this.toTransform,
157-
fromTransform: this.fromTransform
158-
};
159-
}
139+
) {}
160140

161141
ngOnInit() {
162142
if (!this.content) {

0 commit comments

Comments
 (0)