hyprland-website/src/routes/PreviewRiceSlice.svelte

43 lines
1.3 KiB
Svelte
Raw Normal View History

2023-07-22 20:44:24 +02:00
<script>
import { inview } from 'svelte-inview'
2023-08-05 20:33:07 +02:00
import previewRice from '$lib/videos/end_4_rice_intro.mp4'
import previewRiceThumbnail from '$lib/videos/end_4_thumbnail.png'
2023-07-22 20:44:24 +02:00
/** @type HTMLVideoElement */
let videoElement
</script>
<section
class="max-w-7xl relative animate-in [animation-delay:1700ms] fade-in-0 fill-mode-backwards [animation-duration:2000ms] slide-in-from-bottom-10 z-20 {$$restProps.class}"
>
<div
2023-08-05 20:33:07 +02:00
class="rounded-xl opacity-20 overflow-hidden border-sky-400 border-2 scale-90 transition-all [transition-duration:1460ms]"
2023-07-22 20:44:24 +02:00
use:inview={{ unobserveOnEnter: true, threshold: 0.8 }}
on:inview_enter={({ detail: { node } }) => {
node.classList.remove('opacity-20')
node.classList.remove('scale-90')
2023-07-31 11:32:19 +02:00
videoElement.play()
2023-07-22 20:44:24 +02:00
}}
>
<video
bind:this={videoElement}
src={previewRice}
disablepictureinpicture="true"
disableremoteplayback="true"
loop
muted
preload="auto"
2023-08-05 20:33:07 +02:00
poster={previewRiceThumbnail}
2023-07-22 20:44:24 +02:00
/>
</div>
<div class="preview-rice-bg" aria="hidden" />
</section>
<style lang="postcss">
.preview-rice-bg {
@apply w-screen max-w-7xl h-full absolute -z-10 -top-20 left-1/2 -translate-x-1/2 opacity-50;
/* background-color: red; */
2023-08-05 20:33:07 +02:00
background-image: radial-gradient(closest-side, theme(colors.sky.500), transparent);
2023-07-22 20:44:24 +02:00
}
</style>