feat(theme): add sleeping dark mode portrait
This commit is contained in:
+35
-4
@@ -22,10 +22,6 @@ html[data-poyraz-theme="light"] body {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
html[data-poyraz-theme="dark"] [data-cursor-portrait] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@layer utilities {
|
||||
@keyframes marquee {
|
||||
0% { transform: translateX(0%); }
|
||||
@@ -40,4 +36,39 @@ html[data-poyraz-theme="dark"] [data-cursor-portrait] {
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
@keyframes sleepy-z {
|
||||
0%, 12% {
|
||||
opacity: 0;
|
||||
transform: translate3d(0, 0.45rem, 0) scale(0.82) rotate(-8deg);
|
||||
}
|
||||
28%, 68% {
|
||||
opacity: 0.95;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: translate3d(-0.3rem, -0.85rem, 0) scale(1.12) rotate(4deg);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-sleepy-z {
|
||||
animation: sleepy-z 2.8s ease-in-out infinite;
|
||||
opacity: 0;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
[data-sleepy-z="2"] {
|
||||
animation-delay: 0.5s;
|
||||
}
|
||||
|
||||
[data-sleepy-z="3"] {
|
||||
animation-delay: 1s;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.animate-sleepy-z {
|
||||
animation: none;
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
|
||||
const VIDEO_SRC = "/media/cursor-portrait/poyraz-bottom-right.mp4";
|
||||
const POSTER_SRC = "/media/cursor-portrait/poyraz-bottom-right-poster.webp";
|
||||
const NIGHT_SRC = "/media/cursor-portrait/gece.webp";
|
||||
|
||||
const SEEK_INTERVAL_MS = 1000 / 60;
|
||||
const MIN_TIME_DELTA = 0.002;
|
||||
@@ -21,8 +22,8 @@ type DisplayMode =
|
||||
| "pending"
|
||||
| "interactive"
|
||||
| "poster-reduced"
|
||||
| "hidden-mobile"
|
||||
| "hidden-dark";
|
||||
| "night-static"
|
||||
| "hidden-mobile";
|
||||
|
||||
function subscribeToMediaQuery(query: MediaQueryList, listener: () => void) {
|
||||
if (typeof query.addEventListener === "function") {
|
||||
@@ -52,13 +53,13 @@ export function PoyrazBottomRightFollower() {
|
||||
const reducedMotionQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
|
||||
|
||||
const updateDisplayMode = () => {
|
||||
if (document.documentElement.dataset.poyrazTheme === "dark") {
|
||||
setDisplayMode("hidden-dark");
|
||||
if (!desktopQuery.matches || !finePointerQuery.matches) {
|
||||
setDisplayMode("hidden-mobile");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!desktopQuery.matches || !finePointerQuery.matches) {
|
||||
setDisplayMode("hidden-mobile");
|
||||
if (document.documentElement.dataset.poyrazTheme === "dark") {
|
||||
setDisplayMode("night-static");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -252,12 +253,9 @@ export function PoyrazBottomRightFollower() {
|
||||
}, [displayMode, videoFailed]);
|
||||
|
||||
const showVideo = displayMode === "interactive" && !videoFailed;
|
||||
const showNight = displayMode === "night-static";
|
||||
|
||||
if (
|
||||
displayMode === "pending" ||
|
||||
displayMode === "hidden-mobile" ||
|
||||
displayMode === "hidden-dark"
|
||||
) {
|
||||
if (displayMode === "pending" || displayMode === "hidden-mobile") {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -265,9 +263,39 @@ export function PoyrazBottomRightFollower() {
|
||||
<div
|
||||
aria-hidden="true"
|
||||
data-cursor-portrait
|
||||
className="pointer-events-none fixed right-6 bottom-0 z-40 aspect-square w-[clamp(110px,11vw,170px)] select-none bg-white"
|
||||
data-portrait-mode={showNight ? "night" : "day"}
|
||||
className={`pointer-events-none fixed right-6 bottom-0 z-40 aspect-square w-[clamp(110px,11vw,170px)] select-none ${showNight ? "bg-transparent" : "bg-white"}`}
|
||||
>
|
||||
{showVideo ? (
|
||||
{showNight ? (
|
||||
<>
|
||||
<Image
|
||||
src={NIGHT_SRC}
|
||||
alt=""
|
||||
fill
|
||||
sizes="(max-width: 1545px) 11vw, 170px"
|
||||
draggable={false}
|
||||
className="object-contain"
|
||||
/>
|
||||
<span
|
||||
data-sleepy-z="1"
|
||||
className="animate-sleepy-z absolute top-[22%] left-[31%] z-10 font-secondary text-[clamp(11px,1vw,15px)] font-bold text-red-100 drop-shadow-[0_0_5px_rgba(248,113,113,0.75)]"
|
||||
>
|
||||
Z
|
||||
</span>
|
||||
<span
|
||||
data-sleepy-z="2"
|
||||
className="animate-sleepy-z absolute top-[13%] left-[22%] z-10 font-secondary text-[clamp(13px,1.15vw,18px)] font-bold text-red-100 drop-shadow-[0_0_6px_rgba(248,113,113,0.8)]"
|
||||
>
|
||||
Z
|
||||
</span>
|
||||
<span
|
||||
data-sleepy-z="3"
|
||||
className="animate-sleepy-z absolute top-[3%] left-[12%] z-10 font-secondary text-[clamp(15px,1.3vw,21px)] font-bold text-red-100 drop-shadow-[0_0_7px_rgba(248,113,113,0.85)]"
|
||||
>
|
||||
Z
|
||||
</span>
|
||||
</>
|
||||
) : showVideo ? (
|
||||
<video
|
||||
ref={videoRef}
|
||||
src={VIDEO_SRC}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 814 KiB |
Reference in New Issue
Block a user