Skip to content

Commit 94b0b58

Browse files
committed
Scrim background needs to fade with image.
1 parent 88f4a94 commit 94b0b58

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/pages/work/ml-education.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ import Layout from '../../layouts/Layout.astro';
431431
// Only the image fades — scrim and text stay put,
432432
// keeping the bottom text legible throughout.
433433
const heroImage = document.getElementById('story-hero-image');
434+
const scrim = document.querySelector('.story-hero__scrim');
434435
const heroEl = document.getElementById('story-hero');
435436

436437
let lastOpacity = -1;
@@ -444,6 +445,7 @@ import Layout from '../../layouts/Layout.astro';
444445
if (Math.abs(opacity - lastOpacity) < 0.005) return;
445446
lastOpacity = opacity;
446447
heroImage.style.opacity = String(opacity);
448+
scrim.style.opacity = String(opacity);
447449
}
448450

449451
window.addEventListener('scroll', () => {

src/pages/work/quantum-gaming.astro

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ import Layout from '../../layouts/Layout.astro';
1414
<div class="story-hero__image" id="story-hero-image"
1515
style={`background-image: url('${import.meta.env.BASE_URL}images/quantum-games.png');`}>
1616
</div>
17+
<!-- For video, replace the preceding DIV with the following tag.
18+
<video
19+
class="story-hero__image"
20+
id="story-hero-image"
21+
autoplay
22+
muted
23+
loop
24+
playsinline
25+
style="width:100%; height:100%; object-fit:cover; position:absolute; inset:0;"
26+
>
27+
<source src={`${import.meta.env.BASE_URL}images/my_awesome_video.mp4`} type="video/mp4"/>
28+
</video><Up>
29+
-->
1730
<div class="story-hero__scrim"></div>
1831
<div class="story-hero__content">
1932
<span class="story-hero__label">01 — Transformation</span>
@@ -415,6 +428,7 @@ import Layout from '../../layouts/Layout.astro';
415428

416429
<script>
417430
const heroImage = document.getElementById('story-hero-image');
431+
const scrim = document.querySelector('.story-hero__scrim');
418432
const heroEl = document.getElementById('story-hero');
419433

420434
let lastOpacity = -1;
@@ -428,6 +442,7 @@ import Layout from '../../layouts/Layout.astro';
428442
if (Math.abs(opacity - lastOpacity) < 0.005) return;
429443
lastOpacity = opacity;
430444
heroImage.style.opacity = String(opacity);
445+
scrim.style.opacity = String(opacity)
431446
}
432447

433448
window.addEventListener('scroll', () => {

0 commit comments

Comments
 (0)