Skip to content

Commit d6f1961

Browse files
committed
Обновление: добавлены новые компоненты LightPillar, FloatingLines, ColorBends и GridScan с оптимизацией загрузки и выбором фонов в режиме разработки
1 parent b6b0dff commit d6f1961

File tree

1 file changed

+109
-2
lines changed

1 file changed

+109
-2
lines changed

src/components/OBS_Components/Credits/Credits.tsx

Lines changed: 109 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,21 @@ const Squares = lazy(
7474
const Threads = lazy(
7575
() => import("react-bits/src/ts-default/Backgrounds/Threads/Threads")
7676
);
77+
const LightPillar = lazy(
78+
() => import("react-bits/src/ts-default/Backgrounds/LightPillar/LightPillar")
79+
);
80+
const FloatingLines = lazy(
81+
() =>
82+
import("react-bits/src/ts-default/Backgrounds/FloatingLines/FloatingLines")
83+
);
84+
const ColorBends = lazy(
85+
() => import("react-bits/src/ts-default/Backgrounds/ColorBends/ColorBends")
86+
);
87+
const GridScan = lazy(() =>
88+
import("react-bits/src/ts-default/Backgrounds/GridScan/GridScan").then(
89+
module => ({ default: module.GridScan })
90+
)
91+
);
7792

7893
// ОПТИМИЗАЦИЯ: Загружаем музыку НЕ eager - только когда нужно
7994
const musicFiles = import.meta.glob("./music/*.{mp3,ogg,wav}", {
@@ -268,6 +283,84 @@ const backgroundConfigs = [
268283
</Suspense>
269284
),
270285
},
286+
{
287+
name: "LightPillar",
288+
element: (
289+
<Suspense fallback={<div />}>
290+
<LightPillar
291+
topColor="#7cff67"
292+
bottomColor="#5227FF"
293+
intensity={1.1}
294+
rotationSpeed={0.25}
295+
glowAmount={0.0075}
296+
pillarWidth={3.5}
297+
pillarHeight={0.45}
298+
noiseIntensity={0.35}
299+
mixBlendMode="screen"
300+
/>
301+
</Suspense>
302+
),
303+
},
304+
{
305+
name: "FloatingLines",
306+
element: (
307+
<Suspense fallback={<div />}>
308+
<FloatingLines
309+
linesGradient={["#5227FF", "#FF9FFC", "#7cff67", "#B19EEF"]}
310+
enabledWaves={["top", "middle", "bottom"]}
311+
lineCount={[4, 6, 5]}
312+
lineDistance={[12, 10, 14]}
313+
animationSpeed={0.9}
314+
interactive={false}
315+
parallax={false}
316+
mixBlendMode="screen"
317+
/>
318+
</Suspense>
319+
),
320+
},
321+
{
322+
name: "ColorBends",
323+
element: (
324+
<Suspense fallback={<div />}>
325+
<ColorBends
326+
colors={["#5227FF", "#FF9FFC", "#7cff67", "#B19EEF"]}
327+
rotation={35}
328+
speed={0.18}
329+
warpStrength={1.2}
330+
mouseInfluence={0}
331+
parallax={0.25}
332+
noise={0.05}
333+
/>
334+
</Suspense>
335+
),
336+
},
337+
{
338+
name: "GridScan",
339+
element: (
340+
<Suspense fallback={<div />}>
341+
<GridScan
342+
enableWebcam={false}
343+
showPreview={false}
344+
linesColor="#311b4f"
345+
scanColor="#5227FF"
346+
scanOpacity={0.25}
347+
gridScale={0.08}
348+
lineThickness={1.2}
349+
lineStyle="solid"
350+
lineJitter={0.05}
351+
enablePost={true}
352+
bloomIntensity={0.4}
353+
bloomThreshold={0.6}
354+
bloomSmoothing={0.8}
355+
chromaticAberration={0.0015}
356+
noiseIntensity={0.02}
357+
scanGlow={0.6}
358+
scanSoftness={1.6}
359+
scanDirection="pingpong"
360+
/>
361+
</Suspense>
362+
),
363+
},
271364
];
272365

273366
// Импортируем иконки через import.meta.glob
@@ -448,8 +541,22 @@ const Credits: React.FC = () => {
448541

449542
const selectRandomBackground = useCallback(() => {
450543
if (!backgroundConfigs.length) return;
451-
const randomIndex = Math.floor(Math.random() * backgroundConfigs.length);
452-
const selected = backgroundConfigs[randomIndex];
544+
545+
// В режиме разработки используем только 4 конкретных фона
546+
const devBackgrounds = [
547+
"LightPillar",
548+
"FloatingLines",
549+
"ColorBends",
550+
"GridScan",
551+
];
552+
const availableBackgrounds = import.meta.env.DEV
553+
? backgroundConfigs.filter(bg => devBackgrounds.includes(bg.name))
554+
: backgroundConfigs;
555+
556+
if (!availableBackgrounds.length) return;
557+
558+
const randomIndex = Math.floor(Math.random() * availableBackgrounds.length);
559+
const selected = availableBackgrounds[randomIndex];
453560
console.log("Выбран фон для титров:", selected.name);
454561
setSelectedBackground(selected);
455562
}, []);

0 commit comments

Comments
 (0)