Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed public/images/php8/hero-bg-dark.webm
Binary file not shown.
Binary file removed public/images/php8/hero-bg-light.webm
Binary file not shown.
74 changes: 63 additions & 11 deletions public/styles/php85.css
Original file line number Diff line number Diff line change
Expand Up @@ -463,28 +463,80 @@ a {

.hero .hero-bg {
pointer-events: none;
top: calc(var(--spacing) * 0);
inset: 0;
z-index: calc(10 * -1);
object-fit: cover;
width: 100%;
height: 100%;
overflow: hidden;
opacity: .35;
container-type: size;
-webkit-user-select: none;
user-select: none;
position: absolute
}

.hero .hero-bg-dark,
.hero .hero-bg-light:where(.dark,.dark *) {
display: none
/*
* Each orb is a square the size of the larger hero dimension, centered in the hero
* (equivalent to an SVG viewBox with preserveAspectRatio="xMidYMid slice").
* The gradients are static images, so the browser only has to rasterize them once.
* The x/y/rotate animations are applied to nested HTML elements and only change
* transform, so they can run on the compositor instead of repainting every frame.
*/
.hero-orb {
position: absolute;
top: 50%;
left: 50%;
width: max(100cqw, 100cqh);
aspect-ratio: 1;
translate: -50% -50%
}

.hero-orb div {
width: 100%;
height: 100%;
background-size: 100% 100%
}

.hero-orb-1-r {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><radialGradient id='g' cx='.5' cy='.5' fx='.00441602' fy='.5' r='.5'><stop offset='0' stop-color='rgba(210, 203, 255, 1)'/><stop offset='1' stop-color='rgba(51, 63, 124, 0)'/></radialGradient><rect width='100' height='100' fill='url(%23g)'/></svg>")
}

.hero-orb-2-r {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><radialGradient id='g' cx='.5' cy='.5' fx='.0268147' fy='.5' r='.5'><stop offset='0' stop-color='rgba(133, 109, 255, 1)'/><stop offset='1' stop-color='rgba(51, 63, 124, 0)'/></radialGradient><rect width='100' height='100' fill='url(%23g)'/></svg>")
}

.hero-orb-3-r {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><radialGradient id='g' cx='.5' cy='.5' fx='.00836536' fy='.5' r='.5'><stop offset='0' stop-color='rgba(210, 203, 255, 1)'/><stop offset='1' stop-color='rgba(51, 63, 124, 0)'/></radialGradient><rect width='100' height='100' fill='url(%23g)'/></svg>")
}

.hero .hero-bg-dark:where(.dark,.dark *) {
display: block
.hero-orb-1-x { animation: hero-orb1-x 10s linear infinite alternate }
.hero-orb-1-y { animation: hero-orb1-y 10.5s linear infinite alternate }
.hero-orb-1-r { animation: hero-orb-rotate-fwd 7s linear infinite }

.hero-orb-2-x { animation: hero-orb2-x 11.5s linear infinite alternate }
.hero-orb-2-y { animation: hero-orb2-y 12s linear infinite alternate }
.hero-orb-2-r { animation: hero-orb-rotate-fwd 12s linear infinite }

.hero-orb-3-x { animation: hero-orb3-x 12.5s linear infinite alternate }
.hero-orb-3-y { animation: hero-orb3-y 6s linear infinite alternate }
.hero-orb-3-r { animation: hero-orb-rotate-rev 9s linear infinite }

@keyframes hero-orb1-x { from { transform: translateX(25%) } to { transform: translateX(0%) } }
@keyframes hero-orb1-y { from { transform: translateY(0%) } to { transform: translateY(25%) } }
@keyframes hero-orb2-x { from { transform: translateX(-25%) } to { transform: translateX(0%) } }
@keyframes hero-orb2-y { from { transform: translateY(0%) } to { transform: translateY(50%) } }
@keyframes hero-orb3-x { from { transform: translateX(0%) } to { transform: translateX(25%) } }
@keyframes hero-orb3-y { from { transform: translateY(0%) } to { transform: translateY(25%) } }
@keyframes hero-orb-rotate-fwd { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }
@keyframes hero-orb-rotate-rev { from { transform: rotate(360deg) } to { transform: rotate(0deg) } }

.hero-bg.paused .hero-orb,
.hero-bg.paused .hero-orb div {
animation-play-state: paused
}

@media (prefers-reduced-motion: reduce) {
.hero .hero-bg {
display: none !important
.hero-orb,
.hero-orb div {
animation-play-state: paused
}
}

Expand Down
19 changes: 13 additions & 6 deletions src/Themes/ReleasePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ public static function getHeroSection(

return <<<HTML
<section class="hero">
<video class="hero-bg hero-bg-light" autoplay muted loop playsinline disablepictureinpicture aria-hidden="true" tabindex="-1">
<source src="/images/php8/hero-bg-light.webm" type="video/webm">
</video>
<video class="hero-bg hero-bg-dark" autoplay muted loop playsinline disablepictureinpicture aria-hidden="true" tabindex="-1">
<source src="/images/php8/hero-bg-dark.webm" type="video/webm">
</video>
<div class="hero-bg" aria-hidden="true">
<div class="hero-orb hero-orb-1-x"><div class="hero-orb-1-y"><div class="hero-orb-1-r"></div></div></div>
<div class="hero-orb hero-orb-2-x"><div class="hero-orb-2-y"><div class="hero-orb-2-r"></div></div></div>
<div class="hero-orb hero-orb-3-x"><div class="hero-orb-3-y"><div class="hero-orb-3-r"></div></div></div>
</div>

<!-- hero background pattern -->
<svg aria-hidden="true" class="hero-pattern">
Expand Down Expand Up @@ -115,6 +114,14 @@ public static function getPrefooter(string $title, string $upgradeNow, string $d
</svg>

<script>
// Pause the hero background animation while it is scrolled out of view.
const heroBg = document.querySelector('.hero-bg');
if (heroBg && 'IntersectionObserver' in window) {
new IntersectionObserver(([entry]) => {
heroBg.classList.toggle('paused', !entry.isIntersecting);
}).observe(heroBg);
}

document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('click', async (e) => {
const btn = e.target.closest('.js-copy-code');
Expand Down
Loading