Content & marketing
Parallax Cinematic code
Copy the implementation or inspect every file that belongs to this component unit.
resources/views/components/ui/parallax-cinematic.blade.php
@props([
'image',
'alt' => '',
'eyebrow' => null,
'title' => null,
'description' => null,
])
@php
/*
| Cinematic parallax. Adds a heavy vignette, film grain and slow image drift
| for darker editorial hero sections.
*/
@endphp
<section
x-data="{
y: 0,
reduced: window.matchMedia('(prefers-reduced-motion: reduce)').matches,
update() {
if (this.reduced) {
this.y = 0;
return;
}
this.y = $el.getBoundingClientRect().top * -0.1;
},
}"
x-init="update()"
@scroll.window.passive="update()"
{{ $attributes->merge(['class' => 'relative isolate flex min-h-screen overflow-hidden bg-gray-950']) }}
>
<img
src="{{ $image }}"
alt="{{ $alt }}"
@if ($alt === '') aria-hidden="true" @endif
class="pointer-events-none absolute inset-0 -z-30 h-full w-full scale-[1.12] object-cover saturate-[0.82] will-change-transform motion-reduce:scale-100 motion-reduce:transform-none"
style="transform: translate3d(0, 0, 0) scale(1.12);"
:style="reduced ? 'transform: translate3d(0, 0, 0) scale(1);' : `transform: translate3d(0, ${y}px, 0) scale(1.12);`"
>
<div class="absolute inset-0 -z-20 bg-[radial-gradient(circle_at_50%_35%,transparent_0%,rgba(12,14,18,0.20)_34%,rgba(12,14,18,0.88)_100%)]" aria-hidden="true"></div>
<div class="parallax-grain absolute inset-0 -z-10 opacity-35 mix-blend-soft-light" aria-hidden="true"></div>
<div class="absolute inset-x-0 top-0 -z-10 h-24 bg-gradient-to-b from-black/80 to-transparent" aria-hidden="true"></div>
<div class="absolute inset-x-0 bottom-0 -z-10 h-40 bg-gradient-to-t from-black/90 to-transparent" aria-hidden="true"></div>
<div class="mx-auto flex w-full max-w-7xl items-end px-6 py-16 sm:px-8 lg:px-10">
<div class="max-w-3xl">
@if ($eyebrow)
<x-ui.badge variant="brand" icon="aperture" class="bg-white/12 text-white ring-1 ring-white/20 backdrop-blur dark:bg-white/12 dark:text-white">
{{ $eyebrow }}
</x-ui.badge>
@endif
@if ($title)
<h2 class="mt-5 text-4xl font-semibold tracking-tight text-white text-balance sm:text-6xl">{{ $title }}</h2>
@endif
@if ($description)
<p class="mt-5 max-w-2xl text-base leading-7 text-white/76 text-pretty sm:text-lg">{{ $description }}</p>
@endif
@isset($actions)
<div class="mt-8 flex flex-col gap-3 sm:flex-row">{{ $actions }}</div>
@endisset
</div>
</div>
</section>