This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gallery): replace anuglar morph animations with own implementatio…
…n to make everything work on ios
- Loading branch information
1 parent
8f72a52
commit 95a6887
Showing
15 changed files
with
337 additions
and
467 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { animation, animate, style } from '@angular/animations'; | ||
|
||
export const fade = animation([ | ||
style({ | ||
opacity: '{{ fromOpacity }}' | ||
}), | ||
animate( | ||
'{{ time }}', | ||
style({ | ||
opacity: '{{ toOpacity }}' | ||
}) | ||
) | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
export const linear = (t, from, to, duration) => { | ||
const c = to - from; | ||
return (c * t) / duration + from; | ||
}; | ||
|
||
export const easeInQuad = (t, from, to, duration) => { | ||
const c = to - from; | ||
return c * (t /= duration) * t + from; | ||
}; | ||
|
||
export const easeOutSine = (t, from, to, duration) => { | ||
const c = to - from; | ||
return c * Math.sin((t / duration) * (Math.PI / 2)) + from; | ||
}; | ||
|
||
export const easeInOutQuad = (t, from, to, duration) => { | ||
const c = to - from; | ||
if ((t /= duration / 2) < 1) { | ||
return (c / 2) * t * t + from; | ||
} else { | ||
return (-c / 2) * (--t * (t - 2) - 1) + from; | ||
} | ||
}; | ||
|
||
export const easeOutElastic = (t, b, _c, d) => { | ||
let c = _c - b; | ||
let a, p, s; | ||
s = 1.20158; | ||
p = 0; | ||
a = c; | ||
if (t === 0) { | ||
return b; | ||
} else if ((t /= d) === 1) { | ||
return b + c; | ||
} | ||
if (!p) { | ||
p = d * 0.54; | ||
} | ||
if (a < Math.abs(c)) { | ||
a = c; | ||
s = p / 4; | ||
} else { | ||
s = (p / (2 * Math.PI)) * Math.asin(c / a); | ||
} | ||
return ( | ||
a * Math.pow(2, -10 * t) * Math.sin(((t * d - s) * (2 * Math.PI)) / p) + | ||
c + | ||
b | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 4 additions & 13 deletions
17
projects/core/src/lib/gallery/gallery-image/gallery-image.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,6 @@ | ||
<ng-container *ngIf="!overlay.open && !src"> | ||
<ng-container *ngIf="!src"> | ||
<ng-content></ng-content> | ||
</ng-container> | ||
|
||
<img #thumbnail [ngClass]="{'hidden': (overlay.open || !src)}" class="thumbnail" [src]="src" (click)="open()"> | ||
<fiv-overlay #overlay> | ||
|
||
<div [style.backgroundColor]="backdropColor" | ||
*ngIf="overlay.open && viewerState !== 'out' && viewerState !== 'slideout'" [@fade]="viewerState" class="backdrop"> | ||
</div> | ||
|
||
<img *ngIf="overlay.open" class="viewer-image" (@image.done)="handleViewerAnimation($event)" | ||
[@image]="{ value: viewerState, params : animationParams}" [src]="src"> | ||
|
||
</fiv-overlay> | ||
<fiv-ripple (click)="open()"> | ||
<img #thumbnail class="thumbnail" [src]="src"> | ||
</fiv-ripple> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.