Compare commits

..
Author SHA1 Message Date
Lotus CIandClaude Opus 5.5 6b3f25e8a8 feat(seasonal): Christmas redesign — garland above the header, snow that shows on light themes (#240)
CI / Build & Quality Checks (push) Skipped
CI / Secret scan (gitleaks) (push) Skipped
CI / Playwright smoke (e2e) (push) Skipped
CI / Build & Quality Checks (pull_request) Successful in 3m22s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 15s
CI / Playwright smoke (e2e) (pull_request) Successful in 22m34s
- String lights are a real garland: a wire in shallow scallops with small
  bulbs hanging from it, all within the top ~16px so they stay above header
  icons and text (the old bokeh orbs covered the phone back/search icons).
  One repeating SVG tile; two bulb sets twinkle alternately (opacity only).
- Snow has a white core plus a blue-grey rim, so it shows on light themes
  (it was invisible) as well as dark; six-armed crystals drift in front.
- The frost vignette is gone and the bottom wash is lighter, so the composer
  area is no longer greyed on light themes.
- Reduced motion: static garland and a still scatter of snow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-25 23:09:14 -04:00
4 changed files with 463 additions and 241 deletions

No files matched your search

@@ -25,13 +25,13 @@ export const animSnowSway = keyframes({
});
/**
* String-light breathing — bokeh orbs softly pulse in brightness and scale,
* like incandescent bulbs warming and cooling. Opacity + transform only.
* String-light twinkle — each bulb set softly brightens and dims, like
* incandescent bulbs warming and cooling. Opacity only.
*/
export const animBulbBreathe = keyframes({
'0%': { transform: 'scale(0.92)', opacity: '0.55' },
'50%': { transform: 'scale(1.08)', opacity: '0.95' },
'100%': { transform: 'scale(0.92)', opacity: '0.55' },
'0%': { opacity: '0.6' },
'50%': { opacity: '1' },
'100%': { opacity: '0.6' },
});
/**
@@ -44,13 +44,3 @@ export const animAurora = keyframes({
'50%': { transform: 'translate3d(6%, 0, 0) scaleY(1.08)', opacity: '0.8' },
'100%': { transform: 'translate3d(-6%, 0, 0) scaleY(1)', opacity: '0.5' },
});
/**
* Vignette frost — a barely-there breathing of the cold frame so the static
* tint feels alive without distracting motion.
*/
export const animFrostPulse = keyframes({
'0%': { opacity: '0.85' },
'50%': { opacity: '1' },
'100%': { opacity: '0.85' },
});
+152 -152
View File
@@ -1,12 +1,6 @@
import React, { useMemo } from 'react';
import { SeasonalOverlayProps } from '../types';
import {
animSnowFall,
animSnowSway,
animBulbBreathe,
animAurora,
animFrostPulse,
} from './Christmas.css';
import { animSnowFall, animSnowSway, animBulbBreathe, animAurora } from './Christmas.css';
// Deterministic pseudo-random so the scene is identical every mount (no React
// state per frame). Large primes keep the distribution well spread.
@@ -15,15 +9,71 @@ const rand = (seed: number) => {
return x - Math.floor(x);
};
// Warm incandescent string-light hues in oklch — gold, soft red, cool white,
// pine green, icy blue. Kept luminous and gentle so they read as bokeh glow.
const BULB_COLORS = [
'oklch(0.85 0.12 85)', // warm gold
'oklch(0.72 0.15 28)', // soft red
'oklch(0.95 0.03 230)', // icy white
'oklch(0.78 0.13 150)', // pine green
'oklch(0.8 0.1 235)', // cool blue
// [Gitea #240] The string lights are a real garland now: a thin wire in
// shallow scallops with small bulbs hanging from it, all inside the top ~16px so
// they sit above the header's icons and text instead of over them (phone
// header icons start ~18px down; the bulbs end by ~15px). One 600px
// SVG tile (five scallops, five colours) repeats across the width; bulbs are
// split into two sets that twinkle alternately (opacity only).
const TILE_W = 600;
const TILE_H = 18;
const SCALLOP = 120;
const svgUrl = (body: string) =>
`url("data:image/svg+xml,${encodeURIComponent(
`<svg xmlns='http://www.w3.org/2000/svg' width='${TILE_W}' height='${TILE_H}' viewBox='0 0 ${TILE_W} ${TILE_H}'>${body}</svg>`,
)}")`;
const GARLAND_HUES = [
'oklch(0.66 0.2 27)', // red
'oklch(0.84 0.15 85)', // gold
'oklch(0.66 0.16 150)', // green
'oklch(0.66 0.14 245)', // blue
'oklch(0.93 0.05 90)', // warm white
];
const bulbsSvg = (which: 0 | 1, glow: boolean) =>
GARLAND_HUES.map((hue, k) => {
if (k % 2 !== which) return '';
const x = SCALLOP / 2 + k * SCALLOP;
if (glow) return `<ellipse cx='${x}' cy='11' rx='6' ry='6' fill='${hue}' opacity='0.55'/>`;
return (
`<rect x='${x - 1.5}' y='5.4' width='3' height='2.6' rx='0.7' fill='oklch(0.5 0.03 150)'/>` +
`<ellipse cx='${x}' cy='11.4' rx='2.7' ry='3.6' fill='${hue}'/>` +
`<ellipse cx='${x - 0.9}' cy='10' rx='0.8' ry='1.2' fill='white' opacity='0.7'/>`
);
}).join('');
const GLOW_FILTER =
"<filter id='g' x='-1' y='-1' width='3' height='3'><feGaussianBlur stdDeviation='2.6'/></filter>";
const WIRE = svgUrl(
`<path d='M0 1 Q${SCALLOP / 2} 10 ${SCALLOP} 1 ${Array.from(
{ length: TILE_W / SCALLOP - 1 },
(_, i) => `T${(i + 2) * SCALLOP} 1`,
).join(
' ',
)}' fill='none' stroke='oklch(0.58 0.05 150)' stroke-width='1.2' stroke-opacity='0.8'/>`,
);
const BULBS_A = svgUrl(
`${GLOW_FILTER}<g filter='url(#g)'>${bulbsSvg(0, true)}</g>${bulbsSvg(0, false)}`,
);
const BULBS_B = svgUrl(
`${GLOW_FILTER}<g filter='url(#g)'>${bulbsSvg(1, true)}</g>${bulbsSvg(1, false)}`,
);
// A six-armed snowflake for the near layer: a blue-grey halo stroke under a
// white one, so it reads on light themes as well as dark (no CSS filter).
const CRYSTAL_ARMS = Array.from({ length: 6 }, (_, i) => i * 60)
.map(
(a) =>
`<g transform='rotate(${a} 12 12)'><path d='M12 12V2.5M12 6l-2.6-2.4M12 6l2.6-2.4M12 9.2l-1.8-1.6M12 9.2l1.8-1.6'/></g>`,
)
.join('');
const crystalUrl = `url("data:image/svg+xml,${encodeURIComponent(
`<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><g fill='none' stroke-linecap='round'><g stroke='oklch(0.55 0.05 245)' stroke-opacity='0.55' stroke-width='2.6'>${CRYSTAL_ARMS}</g><g stroke='white' stroke-width='1.2'>${CRYSTAL_ARMS}</g></g></svg>`,
)}")`;
// Snow dot: white core with a soft blue-grey rim and shadow — visible on white
// (the rim) and on dark (the core).
const FLAKE_BG =
'radial-gradient(circle at 38% 35%, oklch(1 0 0) 0%, oklch(0.97 0.01 230) 55%, oklch(0.9 0.03 235) 100%)';
const FLAKE_SHADOW = '0 0 0 0.6px oklch(0.6 0.04 240 / 0.55), 0 1px 2px oklch(0.35 0.05 245 / 0.3)';
type Flake = {
left: number;
@@ -35,22 +85,13 @@ type Flake = {
blur: number;
};
type Bulb = {
left: number;
top: number;
size: number;
color: string;
duration: number;
delay: number;
};
export function ChristmasOverlay({ reduced }: SeasonalOverlayProps) {
// Three parallax bands of snow: far (small/slow/dim) -> near (large/fast).
const flakes = useMemo<Flake[]>(() => {
const bands = [
{ count: 12, size: [1.5, 2.5], dur: [16, 22], op: [0.35, 0.55], blur: 0.6 },
{ count: 10, size: [2.5, 4], dur: [11, 15], op: [0.55, 0.8], blur: 0.3 },
{ count: 8, size: [4, 6.5], dur: [8, 11], op: [0.7, 0.95], blur: 0 },
{ count: 16, size: [2, 3], dur: [16, 22], op: [0.5, 0.7], blur: 0.4 },
{ count: 12, size: [3, 4.5], dur: [11, 15], op: [0.65, 0.85], blur: 0 },
{ count: 8, size: [4.5, 6.5], dur: [8, 11], op: [0.8, 1], blur: 0 },
];
const out: Flake[] = [];
let s = 1;
@@ -75,62 +116,53 @@ export function ChristmasOverlay({ reduced }: SeasonalOverlayProps) {
return out;
}, []);
// Bokeh string lights strung along the very top edge, gently sagging.
const bulbs = useMemo<Bulb[]>(() => {
const count = 9;
const out: Bulb[] = [];
for (let i = 0; i < count; i += 1) {
const t = i / (count - 1);
// Two-segment garland sag so the lights drape rather than sit in a line.
const sag = Math.sin(t * Math.PI * 2) * 3.2;
out.push({
left: 4 + t * 92,
top: 2.5 + Math.abs(Math.sin(t * Math.PI)) * 2 + sag,
size: 12 + rand(i + 5) * 8,
color: BULB_COLORS[i % BULB_COLORS.length],
duration: 3.4 + rand(i + 2) * 2.6,
delay: -rand(i + 9) * 3,
});
}
return out;
}, []);
// A few large six-armed crystals drifting in front.
const crystals = useMemo<Flake[]>(
() =>
Array.from({ length: 6 }, (_, i) => ({
left: 6 + rand(i + 40) * 88,
size: 12 + rand(i + 41) * 5,
duration: 13 + rand(i + 42) * 6,
delay: -rand(i + 43) * 19,
swayDuration: 6 + rand(i + 44) * 4,
opacity: 0.55 + rand(i + 45) * 0.15,
blur: 0,
})),
[],
);
const garlandLayer = (image: string, delay: number): React.CSSProperties => ({
position: 'absolute',
top: 0,
left: 0,
right: 0,
height: `${TILE_H}px`,
backgroundImage: image,
backgroundRepeat: 'repeat-x',
backgroundSize: `${TILE_W}px ${TILE_H}px`,
// Start mid-scallop so the wire doesn't begin at a bulb on the far left.
backgroundPosition: '-30px 0',
animation: reduced ? 'none' : `${animBulbBreathe} 3.2s ease-in-out ${delay}s infinite`,
willChange: reduced ? undefined : 'opacity',
});
return (
<>
{/* Deep night-blue ambient wash — layered radial + linear oklch gradients
for depth. Kept low-opacity so chat text stays legible (WCAG-AA). */}
{/* Soft night-blue wash at the top only; the bottom stays clear so the
composer isn't greyed on light themes. */}
<div
aria-hidden="true"
style={{
position: 'absolute',
inset: 0,
contain: 'layout paint style',
backgroundImage: [
'radial-gradient(120% 80% at 50% -10%, oklch(0.25 0.07 250 / 0.16) 0%, transparent 55%)',
'radial-gradient(90% 60% at 85% 110%, oklch(0.3 0.06 255 / 0.1) 0%, transparent 60%)',
'linear-gradient(180deg, oklch(0.95 0.03 230 / 0.05) 0%, transparent 22%, transparent 80%, oklch(0.22 0.07 255 / 0.08) 100%)',
'radial-gradient(120% 70% at 50% -12%, oklch(0.3 0.07 250 / 0.12) 0%, transparent 55%)',
'radial-gradient(70% 40% at 50% 112%, oklch(0.9 0.03 230 / 0.06) 0%, transparent 70%)',
].join(','),
}}
/>
{/* Frosted vignette frame — cold edges, clear center. backdrop-filter on a
single cheap layer for a faint icy haze around the rim. */}
<div
aria-hidden="true"
style={{
position: 'absolute',
inset: 0,
contain: 'layout paint style',
backdropFilter: 'blur(0.4px) saturate(1.04)',
WebkitBackdropFilter: 'blur(0.4px) saturate(1.04)',
backgroundImage:
'radial-gradient(135% 120% at 50% 42%, transparent 52%, oklch(0.9 0.04 225 / 0.07) 74%, oklch(0.28 0.07 250 / 0.16) 100%)',
animation: reduced ? 'none' : `${animFrostPulse} 12s ease-in-out infinite`,
willChange: reduced ? undefined : 'opacity',
}}
/>
{/* Aurora shimmer band high up — soft conic-ish wash of icy blue/green. */}
{/* Aurora shimmer high up — kept faint. */}
<div
aria-hidden="true"
style={{
@@ -138,99 +170,59 @@ export function ChristmasOverlay({ reduced }: SeasonalOverlayProps) {
top: '-6%',
left: '-10%',
right: '-10%',
height: '40%',
contain: 'layout paint style',
height: '32%',
mixBlendMode: 'screen',
filter: 'blur(26px)',
opacity: reduced ? 0.6 : undefined,
opacity: reduced ? 0.45 : undefined,
backgroundImage: [
'radial-gradient(60% 100% at 30% 0%, oklch(0.85 0.12 165 / 0.18) 0%, transparent 70%)',
'radial-gradient(55% 100% at 68% 0%, oklch(0.8 0.1 235 / 0.16) 0%, transparent 72%)',
'radial-gradient(50% 100% at 50% 0%, oklch(0.9 0.06 280 / 0.1) 0%, transparent 75%)',
'radial-gradient(60% 100% at 30% 0%, oklch(0.85 0.12 165 / 0.14) 0%, transparent 70%)',
'radial-gradient(55% 100% at 68% 0%, oklch(0.8 0.1 235 / 0.12) 0%, transparent 72%)',
].join(','),
animation: reduced ? 'none' : `${animAurora} 18s ease-in-out infinite`,
willChange: reduced ? undefined : 'transform, opacity',
}}
/>
{/* String-light wire — a faint catenary line the bulbs hang from. */}
<div
aria-hidden="true"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
height: '14%',
contain: 'layout paint style',
backgroundImage:
'radial-gradient(140% 60% at 50% -30%, oklch(0.3 0.04 250 / 0.14) 0%, transparent 70%)',
}}
/>
{/* Bokeh string lights — soft blurred orbs that breathe. */}
{bulbs.map((b, i) => (
<div
key={`bulb-${i}`}
aria-hidden="true"
style={{
position: 'absolute',
left: `${b.left}%`,
top: `${b.top}%`,
width: `${b.size}px`,
height: `${b.size}px`,
marginLeft: `${-b.size / 2}px`,
borderRadius: '50%',
background: `radial-gradient(circle at 38% 34%, oklch(0.98 0.02 95 / 0.95) 0%, ${b.color} 38%, transparent 72%)`,
boxShadow: `0 0 ${b.size}px ${b.size * 0.45}px ${b.color.replace(')', ' / 0.45)')}`,
filter: 'blur(0.5px)',
opacity: reduced ? 0.9 : undefined,
animation: reduced
? 'none'
: `${animBulbBreathe} ${b.duration}s ease-in-out ${b.delay}s infinite`,
willChange: reduced ? undefined : 'transform, opacity',
}}
/>
))}
{/* Snowfall (motion only) — three parallax bands. Static dusting below. */}
{/* Snowfall (motion) — three parallax bands plus the crystals. */}
{!reduced &&
flakes.map((f, i) => (
<div
key={`snow-${i}`}
aria-hidden="true"
style={{
position: 'absolute',
top: 0,
left: `${f.left}%`,
width: `${f.size}px`,
height: `${f.size}px`,
animation: `${animSnowSway} ${f.swayDuration}s ease-in-out ${f.delay}s infinite`,
willChange: 'transform',
}}
>
[...flakes, ...crystals].map((f, i) => {
const crystal = i >= flakes.length;
return (
<div
key={`snow-${i}`}
aria-hidden="true"
style={{
width: '100%',
height: '100%',
borderRadius: '50%',
background:
'radial-gradient(circle at 35% 35%, oklch(0.99 0.01 230 / 0.95) 0%, oklch(0.95 0.03 230 / 0.7) 60%, transparent 100%)',
boxShadow: '0 0 4px oklch(0.9 0.05 235 / 0.55)',
opacity: f.opacity,
filter: f.blur ? `blur(${f.blur}px)` : undefined,
animation: `${animSnowFall} ${f.duration}s linear ${f.delay}s infinite`,
willChange: 'transform, opacity',
position: 'absolute',
top: 0,
left: `${f.left}%`,
width: `${f.size}px`,
height: `${f.size}px`,
animation: `${animSnowSway} ${f.swayDuration}s ease-in-out ${f.delay}s infinite`,
willChange: 'transform',
}}
/>
</div>
))}
>
<div
style={{
width: '100%',
height: '100%',
...(crystal
? { backgroundImage: crystalUrl, backgroundSize: '100% 100%' }
: { borderRadius: '50%', background: FLAKE_BG, boxShadow: FLAKE_SHADOW }),
opacity: f.opacity,
filter: f.blur ? `blur(${f.blur}px)` : undefined,
animation: `${animSnowFall} ${f.duration}s linear ${f.delay}s infinite`,
willChange: 'transform, opacity',
}}
/>
</div>
);
})}
{/* Static dusting of snow for the reduced-motion / preview scene — a
sparse scatter so the thumbnail still reads as snowfall. */}
{/* Static snow for reduced motion / the settings preview. */}
{reduced &&
flakes.map((f, i) => {
const fy = rand(i + 0.5) * 96 + 2;
[...flakes, ...crystals].map((f, i) => {
const crystal = i >= flakes.length;
const fy = rand(i + 0.5) * 88 + 8;
return (
<div
key={`snow-static-${i}`}
@@ -241,16 +233,24 @@ export function ChristmasOverlay({ reduced }: SeasonalOverlayProps) {
top: `${fy}%`,
width: `${f.size}px`,
height: `${f.size}px`,
borderRadius: '50%',
background:
'radial-gradient(circle at 35% 35%, oklch(0.99 0.01 230 / 0.95) 0%, oklch(0.95 0.03 230 / 0.7) 60%, transparent 100%)',
boxShadow: '0 0 4px oklch(0.9 0.05 235 / 0.5)',
...(crystal
? {
backgroundImage: crystalUrl,
backgroundSize: '100% 100%',
transform: `rotate(${rand(i + 3) * 60}deg)`,
}
: { borderRadius: '50%', background: FLAKE_BG, boxShadow: FLAKE_SHADOW }),
opacity: f.opacity,
filter: f.blur ? `blur(${f.blur}px)` : undefined,
}}
/>
);
})}
{/* The garland on top of everything: wire, then two twinkling bulb sets. */}
<div aria-hidden="true" style={{ ...garlandLayer(WIRE, 0), animation: 'none' }} />
<div aria-hidden="true" style={garlandLayer(BULBS_A, 0)} />
<div aria-hidden="true" style={garlandLayer(BULBS_B, -1.6)} />
</>
);
}
@@ -9,14 +9,46 @@ import { keyframes } from '@vanilla-extract/css';
* component; this module is motion only.
*/
/**
* Lantern bob — a hung lantern rises a touch and sinks again on a long, lazy
* cycle, as if buoyed by warm air. translateY + a whisper of scale only; the
* per-lantern duration/delay desynchronise the swarm.
*/
export const animLanternBob = keyframes({
'0%': { transform: 'translate3d(0, 0, 0) scale(1)' },
'50%': { transform: 'translate3d(0, -2.2vh, 0) scale(1.015)' },
'100%': { transform: 'translate3d(0, 0, 0) scale(1)' },
});
/**
* Lantern pendulum — a gentle rotational sway about the top mount, so each
* lantern rocks like it hangs from a string. Pairs with the bob on a different
* period to read as organic drift rather than a metronome.
*/
export const animLanternSway = keyframes({
'0%': { transform: 'rotate(-2.4deg)' },
'50%': { transform: 'rotate(2.4deg)' },
'100%': { transform: 'rotate(-2.4deg)' },
});
/**
* Tassel sway — the silk tassel under a lantern trails its parent's motion with
* a wider, slightly lagging swing. transformOrigin is the top of the tassel.
*/
export const animTasselSway = keyframes({
'0%': { transform: 'rotate(5deg)' },
'50%': { transform: 'rotate(-5deg)' },
'100%': { transform: 'rotate(5deg)' },
});
/**
* Lantern inner glow — the warm light inside each lantern swells and dims, like
* a candle breathing. Opacity + scale only.
*/
export const animGlowBreathe = keyframes({
'0%': { opacity: '0.7' },
'50%': { opacity: '1' },
'100%': { opacity: '0.7' },
'0%': { transform: 'scale(0.94)', opacity: '0.55' },
'50%': { transform: 'scale(1.06)', opacity: '0.9' },
'100%': { transform: 'scale(0.94)', opacity: '0.55' },
});
/**
@@ -45,6 +77,16 @@ export const animPetalSway = keyframes({
'100%': { transform: 'translate3d(0, 0, 0)' },
});
/**
* Dragon drift — the gold dragon silhouette breathes and undulates almost
* imperceptibly across the scene. translate + scale + opacity only, very slow.
*/
export const animDragonDrift = keyframes({
'0%': { transform: 'translate3d(-2%, 0, 0) scale(1)', opacity: '0.42' },
'50%': { transform: 'translate3d(2%, -1%, 0) scale(1.04)', opacity: '0.6' },
'100%': { transform: 'translate3d(-2%, 0, 0) scale(1)', opacity: '0.42' },
});
/**
* Lacquer-tint breathing — a barely-there pulse of the warm red ambient wash so
* the static base feels alive without distracting motion.
@@ -65,13 +107,3 @@ export const animEmberRise = keyframes({
'80%': { opacity: '0.5' },
'100%': { transform: 'translate3d(0.6vw, -26vh, 0) scale(1)', opacity: '0' },
});
/**
* Lantern garland sway — the lantern set shifts a pixel or two side to side, as
* if in a breeze. Transform only.
*/
export const animGarlandSway = keyframes({
'0%': { transform: 'translate3d(-1.5px, 0, 0)' },
'50%': { transform: 'translate3d(1.5px, 0, 0)' },
'100%': { transform: 'translate3d(-1.5px, 0, 0)' },
});
@@ -1,10 +1,13 @@
import React, { useMemo } from 'react';
import { SeasonalOverlayProps } from '../types';
import {
animGarlandSway,
animLanternBob,
animLanternSway,
animTasselSway,
animGlowBreathe,
animPetalFall,
animPetalSway,
animDragonDrift,
animLacquerPulse,
animEmberRise,
} from './LunarNewYear.css';
@@ -28,6 +31,46 @@ const GOLD_HI = 'oklch(0.92 0.10 92)';
// data-URI so it costs a single GPU-composited layer (no DOM weight). The curve
// is intentionally abstract and very subtle — a calligraphic ribbon-body with a
// suggestion of a head, mane and tail arcing across the upper scene.
const dragonUri = ((): string => {
const svg =
`<svg xmlns='http://www.w3.org/2000/svg' width='760' height='320' viewBox='0 0 760 320'>` +
`<defs>` +
`<linearGradient id='g' x1='0' y1='0' x2='1' y2='0'>` +
`<stop offset='0' stop-color='oklch(0.86 0.13 88)' stop-opacity='0.85'/>` +
`<stop offset='0.55' stop-color='oklch(0.82 0.14 85)' stop-opacity='0.7'/>` +
`<stop offset='1' stop-color='oklch(0.78 0.13 80)' stop-opacity='0.45'/>` +
`</linearGradient>` +
`</defs>` +
`<g fill='none' stroke='url(%23g)' stroke-linecap='round' stroke-linejoin='round'>` +
// Sinuous body — a thick tapering serpentine ribbon.
`<path d='M30 180 C120 90 200 250 300 170 S470 60 560 150 S700 240 740 150' ` +
`stroke-width='26' opacity='0.5'/>` +
// Inner highlight running along the body for a calligraphic sheen.
`<path d='M30 180 C120 90 200 250 300 170 S470 60 560 150 S700 240 740 150' ` +
`stroke-width='7' opacity='0.7'/>` +
// Head + horn flourish at the leading end.
`<path d='M30 180 C10 160 8 130 26 120 M26 120 C36 112 50 116 52 130' ` +
`stroke-width='9' opacity='0.6'/>` +
// Mane / whisker strokes flaring back from the head.
`<path d='M44 134 C70 120 96 132 110 152 M40 150 C66 148 92 160 104 180' ` +
`stroke-width='5' opacity='0.45'/>` +
// Tail wisps.
`<path d='M740 150 C754 138 758 160 748 172 M726 158 C742 168 744 186 732 196' ` +
`stroke-width='5' opacity='0.45'/>` +
`</g></svg>`;
return `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
})();
type Lantern = {
left: number;
top: number;
scale: number;
bobDuration: number;
swayDuration: number;
delay: number;
opacity: number;
};
type Petal = {
left: number;
size: number;
@@ -47,6 +90,8 @@ type Ember = {
delay: number;
};
// A single five-petal plum blossom (gold), inline SVG so each petal sliver is
// one cheap element. Returned as a data-URI background painted on a square.
const blossomUri = ((): string => {
const petals = Array.from({ length: 5 }, (_, i) => {
const a = (i * 72 * Math.PI) / 180;
@@ -62,56 +107,28 @@ const blossomUri = ((): string => {
return `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
})();
// [Gitea #231] Lantern garland: one 480px SVG tile (four scallops) repeats
// across the width; small lanterns hang at the scallop low points, all within
// the top ~20px.
const TILE_W = 480;
const TILE_H = 20;
const SCALLOP = 120;
const tile = (body: string) =>
`url("data:image/svg+xml,${encodeURIComponent(
`<svg xmlns='http://www.w3.org/2000/svg' width='${TILE_W}' height='${TILE_H}' viewBox='0 0 ${TILE_W} ${TILE_H}'>${body}</svg>`,
)}")`;
const CORD = tile(
`<path d='M0 1 Q${SCALLOP / 2} 9 ${SCALLOP} 1 ${Array.from(
{ length: TILE_W / SCALLOP - 1 },
(_, i) => `T${(i + 2) * SCALLOP} 1`,
).join(' ')}' fill='none' stroke='${GOLD}' stroke-width='1.1' stroke-opacity='0.8'/>`,
);
const lanternSvg = (which: 0 | 1) =>
Array.from({ length: TILE_W / SCALLOP }, (_, k) => {
if (k % 2 !== which) return '';
const x = SCALLOP / 2 + k * SCALLOP;
return (
`<ellipse cx='${x}' cy='11.5' rx='9' ry='7' fill='${VERMILION}' opacity='0.28'/>` +
`<rect x='${x - 3}' y='5' width='6' height='1.6' rx='0.6' fill='${GOLD}'/>` +
`<ellipse cx='${x}' cy='11' rx='5.6' ry='4.4' fill='${CRIMSON}' stroke='${GOLD}' stroke-width='0.6'/>` +
`<path d='M${x - 2.4} 7.2 Q${x - 3.4} 11 ${x - 2.4} 14.8 M${x} 6.6 V15.4 M${x + 2.4} 7.2 Q${x + 3.4} 11 ${x + 2.4} 14.8' fill='none' stroke='${GOLD}' stroke-width='0.4' stroke-opacity='0.7'/>` +
`<ellipse cx='${x - 1.6}' cy='9.6' rx='1.6' ry='1.2' fill='${GOLD_HI}' opacity='0.45'/>` +
`<rect x='${x - 2.4}' y='15.2' width='4.8' height='1.4' rx='0.5' fill='${GOLD}'/>` +
`<path d='M${x} 16.6 V19.4' stroke='${GOLD}' stroke-width='0.9' stroke-linecap='round'/>`
);
}).join('');
const LANTERNS_A = tile(lanternSvg(0));
const LANTERNS_B = tile(lanternSvg(1));
export function LunarNewYearOverlay({ reduced }: SeasonalOverlayProps) {
const garlandLayer = (image: string, animated: boolean, delay = 0): React.CSSProperties => ({
position: 'absolute',
top: 0,
left: 0,
right: 0,
height: `${TILE_H}px`,
backgroundImage: image,
backgroundRepeat: 'repeat-x',
backgroundSize: `${TILE_W}px ${TILE_H}px`,
backgroundPosition: '-20px 0',
animation:
reduced || !animated
? 'none'
: `${animGarlandSway} 5.5s ease-in-out ${delay}s infinite, ${animGlowBreathe} 3.8s ease-in-out ${delay}s infinite`,
willChange: reduced || !animated ? undefined : 'transform, opacity',
});
// Paper lanterns strung across the upper third, gently staggered in depth.
const lanterns = useMemo<Lantern[]>(() => {
const slots = [
{ left: 9, top: 7, scale: 1.0 },
{ left: 27, top: 13, scale: 0.82 },
{ left: 46, top: 6, scale: 1.12 },
{ left: 64, top: 15, scale: 0.78 },
{ left: 82, top: 9, scale: 0.95 },
{ left: 92, top: 20, scale: 0.7 },
];
return slots.map((s, i) => ({
left: s.left,
top: s.top,
scale: s.scale,
bobDuration: 7 + rand(i + 1) * 4,
swayDuration: 5.5 + rand(i + 4) * 3,
delay: -rand(i + 7) * 6,
opacity: 0.78 + rand(i + 2) * 0.18,
}));
}, []);
// Drifting gold plum-blossom petals — two parallax bands (far small/dim/slow,
// near large/bright/fast) for depth.
const petals = useMemo<Petal[]>(() => {
@@ -168,33 +185,216 @@ export function LunarNewYearOverlay({ reduced }: SeasonalOverlayProps) {
inset: 0,
contain: 'layout paint style',
backgroundImage: [
`radial-gradient(120% 70% at 50% -8%, ${CRIMSON.replace(')', ' / 0.09)')} 0%, transparent 52%)`,
`linear-gradient(180deg, oklch(0.55 0.20 28 / 0.035) 0%, transparent 22%)`,
`radial-gradient(120% 80% at 50% -8%, ${CRIMSON.replace(')', ' / 0.16)')} 0%, transparent 56%)`,
`radial-gradient(90% 70% at 50% 112%, oklch(0.42 0.17 28 / 0.1) 0%, transparent 60%)`,
`linear-gradient(180deg, oklch(0.55 0.20 28 / 0.07) 0%, transparent 26%, transparent 82%, oklch(0.40 0.16 28 / 0.08) 100%)`,
].join(','),
animation: reduced ? 'none' : `${animLacquerPulse} 13s ease-in-out infinite`,
willChange: reduced ? undefined : 'opacity',
}}
/>
{/* Warm vignette frame — a faint crimson rim, clear center. */}
{/* Imperial-gold dragon silhouette arcing across the upper scene — a
single composited SVG layer, blurred and screen-blended so it reads as
an ethereal gilt apparition, never a hard graphic. */}
<div
aria-hidden="true"
style={{
position: 'absolute',
top: '8%',
left: '-6%',
right: '-6%',
height: '46%',
contain: 'layout paint style',
backgroundImage: dragonUri,
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center',
backgroundSize: 'contain',
mixBlendMode: 'screen',
filter: 'blur(1.1px)',
opacity: reduced ? 0.52 : undefined,
animation: reduced ? 'none' : `${animDragonDrift} 30s ease-in-out infinite`,
willChange: reduced ? undefined : 'transform, opacity',
}}
/>
{/* Warm vignette frame — crimson edges, clear center, with a faint cheap
backdrop-filter for a silken haze around the rim. */}
<div
aria-hidden="true"
style={{
position: 'absolute',
inset: 0,
contain: 'layout paint style',
backdropFilter: 'blur(0.4px) saturate(1.05)',
WebkitBackdropFilter: 'blur(0.4px) saturate(1.05)',
backgroundImage:
'radial-gradient(135% 120% at 50% 40%, transparent 60%, oklch(0.55 0.16 28 / 0.05) 100%)',
'radial-gradient(135% 120% at 50% 40%, transparent 54%, oklch(0.55 0.16 28 / 0.06) 76%, oklch(0.40 0.16 28 / 0.16) 100%)',
}}
/>
{/* [Gitea #231] A garland of small paper lanterns on a scalloped cord, all
within the top ~20px so it stays above header icons and text (the old
lanterns hung 7-20% down, over Create Room, search boxes and messages).
Two lantern sets glow and sway a little, alternately. */}
<div aria-hidden="true" style={garlandLayer(CORD, false)} />
<div aria-hidden="true" style={garlandLayer(LANTERNS_A, true, 0)} />
<div aria-hidden="true" style={garlandLayer(LANTERNS_B, true, -2.2)} />
{/* The garland string the lanterns hang from — a faint warm line. */}
<div
aria-hidden="true"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
height: '6%',
contain: 'layout paint style',
backgroundImage: `radial-gradient(140% 80% at 50% -40%, ${GOLD.replace(
')',
' / 0.14)',
)} 0%, transparent 70%)`,
}}
/>
{/* Paper lanterns. Each is a hung group: a sway wrapper rotating about its
mount, an inner bob, then the lantern body (glow + ribs + caps) and a
trailing tassel. */}
{lanterns.map((l, i) => {
const W = 30 * l.scale;
const H = 38 * l.scale;
const cap = Math.max(8, W * 0.5);
return (
<div
key={`lantern-${i}`}
aria-hidden="true"
style={{
position: 'absolute',
left: `${l.left}%`,
top: `${l.top}%`,
marginLeft: `${-W / 2}px`,
transformOrigin: 'top center',
opacity: l.opacity,
animation: reduced
? 'none'
: `${animLanternSway} ${l.swayDuration}s ease-in-out ${l.delay}s infinite`,
willChange: reduced ? undefined : 'transform',
}}
>
<div
style={{
animation: reduced
? 'none'
: `${animLanternBob} ${l.bobDuration}s ease-in-out ${l.delay}s infinite`,
willChange: reduced ? undefined : 'transform',
}}
>
{/* short cord from the string to the top cap */}
<div
style={{
width: '2px',
height: `${10 * l.scale}px`,
margin: '0 auto',
background: `linear-gradient(${GOLD}, ${GOLD.replace(')', ' / 0.3)')})`,
}}
/>
{/* top gold cap */}
<div
style={{
width: `${cap}px`,
height: `${4 * l.scale}px`,
margin: '0 auto',
borderRadius: `${2 * l.scale}px`,
background: `linear-gradient(90deg, ${GOLD.replace(
')',
' / 0.6)',
)}, ${GOLD_HI}, ${GOLD.replace(')', ' / 0.6)')})`,
boxShadow: `0 0 ${5 * l.scale}px ${GOLD.replace(')', ' / 0.55)')}`,
}}
/>
{/* lantern body */}
<div
style={{
position: 'relative',
width: `${W}px`,
height: `${H}px`,
margin: `${1 * l.scale}px auto`,
borderRadius: '50% / 42%',
background: `radial-gradient(circle at 38% 32%, ${VERMILION.replace(
')',
' / 0.95)',
)} 0%, ${CRIMSON} 58%, oklch(0.40 0.18 26 / 0.95) 100%)`,
border: `${1.2 * l.scale}px solid ${GOLD.replace(')', ' / 0.8)')}`,
boxShadow: `0 0 ${16 * l.scale}px ${CRIMSON.replace(
')',
' / 0.5)',
)}, inset 0 0 ${10 * l.scale}px oklch(0.78 0.16 60 / 0.35)`,
overflow: 'hidden',
}}
>
{/* breathing inner candle glow */}
<div
style={{
position: 'absolute',
left: '50%',
top: '52%',
width: `${W * 0.6}px`,
height: `${H * 0.55}px`,
marginLeft: `${-W * 0.3}px`,
marginTop: `${-H * 0.275}px`,
borderRadius: '50%',
background: `radial-gradient(circle, ${GOLD_HI.replace(
')',
' / 0.9)',
)} 0%, oklch(0.80 0.16 65 / 0.5) 45%, transparent 75%)`,
filter: 'blur(1px)',
animation: reduced
? 'none'
: `${animGlowBreathe} ${l.bobDuration * 0.7}s ease-in-out ${
l.delay
}s infinite`,
willChange: reduced ? undefined : 'transform, opacity',
}}
/>
{/* vertical paper ribs */}
<div
style={{
position: 'absolute',
inset: 0,
backgroundImage: `repeating-linear-gradient(90deg, transparent 0, transparent ${
W / 6 - 0.6
}px, ${GOLD.replace(')', ' / 0.18)')} ${W / 6 - 0.6}px, ${GOLD.replace(
')',
' / 0.18)',
)} ${W / 6}px)`,
}}
/>
</div>
{/* bottom gold cap */}
<div
style={{
width: `${cap}px`,
height: `${4 * l.scale}px`,
margin: '0 auto',
borderRadius: `${2 * l.scale}px`,
background: `linear-gradient(90deg, ${GOLD.replace(
')',
' / 0.6)',
)}, ${GOLD_HI}, ${GOLD.replace(')', ' / 0.6)')})`,
}}
/>
{/* swaying silk tassel */}
<div
style={{
width: `${2 * l.scale}px`,
height: `${16 * l.scale}px`,
margin: '0 auto',
transformOrigin: 'top center',
background: `linear-gradient(${CRIMSON}, ${GOLD.replace(')', ' / 0.8)')})`,
borderRadius: '1px',
animation: reduced
? 'none'
: `${animTasselSway} ${l.swayDuration * 0.8}s ease-in-out ${l.delay}s infinite`,
willChange: reduced ? undefined : 'transform',
}}
/>
</div>
</div>
);
})}
{/* Drifting gold plum-blossom petals (motion only). Static settled
blossoms render below for the reduced/preview scene. */}