mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 17:23:37 +08:00
feat(website): add a night canal scene behind the homepage hero (#17275)
A short painted video plays once behind the homepage introduction in the dark theme: a paper boat on a canal unfolds into a ship of light. It holds on its final frame, shows a still to people who prefer reduced motion, and keeps the first frame if autoplay is refused. The light theme keeps the plain hero.
This commit is contained in:
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
+209
-209
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
Binary file not shown.
@@ -220,6 +220,26 @@ function initializeShowcaseTabs() {
|
||||
play();
|
||||
}
|
||||
|
||||
// Play the hero scene once, only where it shows and motion is welcome. The
|
||||
// video loads nothing until then; the still frame stays if playback fails.
|
||||
function initializeHeroArt() {
|
||||
const art = document.querySelector(".home-art");
|
||||
if (art === null) return;
|
||||
const video = art.querySelector("video");
|
||||
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
||||
const play = () => {
|
||||
if (reduced.matches || getComputedStyle(art).display === "none") return;
|
||||
if (video.ended || !video.paused) return;
|
||||
video.play().catch(() => {
|
||||
// Autoplay can be refused (for example in low-power mode); the still
|
||||
// frame behind the video is the intended fallback.
|
||||
});
|
||||
};
|
||||
play();
|
||||
window.addEventListener("website-theme-change", play);
|
||||
}
|
||||
|
||||
initializeHeroArt();
|
||||
initializePercentDemo();
|
||||
initializeHomeNavigation();
|
||||
initializeShowcaseTabs();
|
||||
|
||||
@@ -1785,9 +1785,88 @@ pre code {
|
||||
gap: clamp(2.75rem, 5vw, 4rem);
|
||||
}
|
||||
.home-intro {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
max-width: 56rem;
|
||||
text-align: center;
|
||||
}
|
||||
/* The scene spans the window; keep it from widening the page. */
|
||||
main:has(.home-art) {
|
||||
overflow-x: clip;
|
||||
}
|
||||
/* A night scene behind the introduction: a paper boat on a canal becomes a
|
||||
ship of light. Dark theme only, since the scene is a night sky. */
|
||||
.home-art {
|
||||
display: none;
|
||||
}
|
||||
:root[data-theme="dark"] .home-art {
|
||||
display: block;
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
top: -5rem;
|
||||
bottom: -3rem;
|
||||
left: 50%;
|
||||
width: 100vw;
|
||||
translate: -50% 0;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
.home-art::before,
|
||||
.home-art video {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: 15% bottom;
|
||||
/* Dim the picture itself so its colour survives behind white text. */
|
||||
filter: brightness(0.62) saturate(1.12);
|
||||
}
|
||||
.home-art::before {
|
||||
content: "";
|
||||
background: url("hero/paper-boat-start.jpg") 15% bottom / cover no-repeat;
|
||||
}
|
||||
.home-art::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
var(--page),
|
||||
transparent 18%,
|
||||
transparent 70%,
|
||||
var(--page)
|
||||
);
|
||||
}
|
||||
:root[data-theme="dark"] .home-intro :is(h1, .lede, .home-question) {
|
||||
text-shadow:
|
||||
0 1px 2px rgb(0 0 0 / 45%),
|
||||
0 2px 24px rgb(0 0 0 / 55%);
|
||||
}
|
||||
:root[data-theme="dark"] .home-intro .lede {
|
||||
color: rgb(236 240 244 / 88%);
|
||||
}
|
||||
/* Over the scene, the outlined links get a frosted fill so they stay legible
|
||||
when the picture behind them is busy. */
|
||||
:root[data-theme="dark"] .home-intro .community-links a {
|
||||
border-color: rgb(237 242 246 / 16%);
|
||||
background: rgb(11 14 17 / 55%);
|
||||
color: rgb(237 242 246 / 82%);
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
backdrop-filter: blur(8px);
|
||||
}
|
||||
:root[data-theme="dark"] .home-intro .community-links a:hover {
|
||||
border-color: rgb(237 242 246 / 32%);
|
||||
color: var(--ink);
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.home-art video {
|
||||
display: none;
|
||||
}
|
||||
.home-art::before {
|
||||
background-image: url("hero/paper-boat-end.jpg");
|
||||
}
|
||||
}
|
||||
/* A question to the reader between the introduction and the buttons. */
|
||||
.home-question {
|
||||
margin-block: 1.4rem 0;
|
||||
@@ -2631,6 +2710,24 @@ pre code {
|
||||
.home-hero {
|
||||
padding-block: 2.8rem;
|
||||
}
|
||||
/* On phones the scene sits under the text instead of behind the headline. */
|
||||
:root[data-theme="dark"] .home-art {
|
||||
top: -2.8rem;
|
||||
}
|
||||
.home-art::before,
|
||||
.home-art video {
|
||||
top: auto;
|
||||
height: 55%;
|
||||
}
|
||||
.home-art::after {
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
var(--page) 45%,
|
||||
transparent 62%,
|
||||
transparent 85%,
|
||||
var(--page)
|
||||
);
|
||||
}
|
||||
.percent-figure,
|
||||
.dino-demo {
|
||||
padding: 1.1rem;
|
||||
|
||||
@@ -235,6 +235,14 @@
|
||||
<section class="container hero home-hero" id="setup">
|
||||
<div class="home-start-grid">
|
||||
<div class="home-intro">
|
||||
<div class="home-art" aria-hidden="true">
|
||||
<video
|
||||
src="assets/hero/paper-boat.mp4"
|
||||
muted
|
||||
playsinline
|
||||
preload="none"
|
||||
></video>
|
||||
</div>
|
||||
<h1>Reverse engineer anything.<br />Reimagine everything.</h1>
|
||||
<p class="lede">
|
||||
Understand how software works, from what an app does on screen
|
||||
|
||||
Reference in New Issue
Block a user