smooth the work loading
This commit is contained in:
parent
441f7c06ee
commit
54d20530e5
2 changed files with 31 additions and 4 deletions
|
|
@ -1,9 +1,8 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, onDestroy } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { gsap } from 'gsap';
|
import { gsap } from 'gsap';
|
||||||
import { ScrollTrigger } from 'gsap/dist/ScrollTrigger';
|
import { ScrollTrigger } from 'gsap/dist/ScrollTrigger';
|
||||||
import ScrollToPlugin from 'gsap/dist/ScrollToPlugin';
|
import { CldImage } from 'svelte-cloudinary';
|
||||||
import { CldImage, CldVideoPlayer } from 'svelte-cloudinary';
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
gsap.registerPlugin(ScrollTrigger);
|
gsap.registerPlugin(ScrollTrigger);
|
||||||
|
|
@ -15,6 +14,29 @@
|
||||||
if (document.querySelector('.workclone')) {
|
if (document.querySelector('.workclone')) {
|
||||||
document.querySelector('.workclone')?.remove();
|
document.querySelector('.workclone')?.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeout( () => {
|
||||||
|
if (document.querySelector('.gallery img')) {
|
||||||
|
document.querySelectorAll('.gallery img').forEach(image => {
|
||||||
|
let img = image as HTMLImageElement;
|
||||||
|
if (!img.complete) {
|
||||||
|
img.classList.add('imageIsLoading');
|
||||||
|
img.onload = () => {
|
||||||
|
gsap.fromTo(img, {
|
||||||
|
autoAlpha: 0,
|
||||||
|
scale: 1.2,
|
||||||
|
}, {
|
||||||
|
autoAlpha: 1,
|
||||||
|
scale: 1,
|
||||||
|
duration: 1,
|
||||||
|
ease: 'power4.out',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, 10)
|
||||||
|
|
||||||
gsap.to('.logo-wrapper', {
|
gsap.to('.logo-wrapper', {
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
zIndex: -1,
|
zIndex: -1,
|
||||||
|
|
@ -322,4 +344,9 @@
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
:global(.imageIsLoading) {
|
||||||
|
visibility: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateZ(700px);
|
transform: translateZ(700px) scaleY(0);
|
||||||
}
|
}
|
||||||
.work-logo {
|
.work-logo {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue