hyprland-website/src/routes/FameRicePreview.svelte

62 lines
1.4 KiB
Svelte
Raw Normal View History

2023-07-23 01:49:29 +02:00
<script>
2023-09-03 18:00:52 +02:00
import { animateIn, getBlurredPath } from '$lib/Helper.mjs'
2023-07-23 01:49:29 +02:00
/** @type {string}
* The path to the image. Usually the file within `static`, but can also be an URL
*/
export let image
/** @type {string | undefined} */
export let imageClass = undefined
/** @type {string | undefined} */
export let containerClass = undefined
</script>
2023-07-31 11:32:19 +02:00
<div class="rice {containerClass} group">
2023-09-03 18:00:52 +02:00
<div class="h-full w-full" use:animateIn={{ slide: 20, duration: 800 }}>
2023-07-31 11:32:19 +02:00
<img
src={image}
alt="Rice desktop"
2023-09-07 21:03:47 +02:00
class="nice-hover w-full rounded-xl object-cover object-top shadow-2xl hover:scale-[1.01] {imageClass}"
2023-07-31 11:32:19 +02:00
/>
2023-09-03 18:00:52 +02:00
<div class="rice-blurred">
<img
src={getBlurredPath(image)}
alt="Rice desktop"
aria-hidden="true"
class="h-full w-full"
/>
</div>
2023-07-23 01:49:29 +02:00
</div>
</div>
<style lang="postcss">
.rice {
@apply relative w-full max-w-[1100px];
}
.nice-hover {
2023-07-31 11:32:19 +02:00
transition: all 540ms cubic-bezier(0.1, -0.81, 0.31, 2);
2023-07-23 01:49:29 +02:00
}
2023-09-03 18:00:52 +02:00
.rice-blurred {
translate: -50% 30%;
position: absolute;
bottom: -40px;
left: 50%;
pointer-events: none;
width: calc(100% + 120px);
height: calc(150% + 120px);
opacity: 0.9;
/* filter: brightness(2.5); */
z-index: -10;
background-color: red;
mask-image: radial-gradient(50% 50% at 50% 50%, black, transparent);
2023-09-07 21:03:47 +02:00
contain: content layout size style;
2023-09-03 18:00:52 +02:00
@apply -z-10 transition-[filter] duration-500;
2023-07-23 01:49:29 +02:00
2023-09-07 21:03:47 +02:00
/* Too laggy on firefox */
/* .rice:hover & {
2023-09-03 18:00:52 +02:00
filter: brightness(4);
2023-09-07 21:03:47 +02:00
} */
2023-07-23 01:49:29 +02:00
}
</style>