Web: wiązania rdzenia jako promienie-trójkaty z gradientem zamiast lini przerywanych
This commit is contained in:
@@ -51,14 +51,17 @@ interface Wire {
|
||||
y1: number;
|
||||
x2: number;
|
||||
y2: number;
|
||||
delay: string;
|
||||
spread: number;
|
||||
id: string;
|
||||
}
|
||||
|
||||
const HUB_RADIUS = 78;
|
||||
const SPREAD_PX = 52;
|
||||
|
||||
/**
|
||||
* Diagram rdzenia (lg+): kafelki uczestników z naturalną wysokością (nic się nie
|
||||
* ucina) i przerywane wiązania mierzone w DOM (ResizeObserver).
|
||||
* ucina) i promienie—trójkąty mierzone w DOM (ResizeObserver): wierzchołek na
|
||||
* obwodzie rdzenia, podstawa na ścianie kafelka.
|
||||
*/
|
||||
function HubDiagram() {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
@@ -73,10 +76,10 @@ function HubDiagram() {
|
||||
if (!container) return;
|
||||
|
||||
const targets = [
|
||||
{ el: trenerRef.current, side: 'left' as const, delay: '0s' },
|
||||
{ el: silowniaRef.current, side: 'left' as const, delay: '-0.5s' },
|
||||
{ el: cwiczacyRef.current, side: 'right' as const, delay: '-0.9s' },
|
||||
{ el: adminRef.current, side: 'right' as const, delay: '-1.3s' },
|
||||
{ el: trenerRef.current, side: 'left' as const, id: 'trener' },
|
||||
{ el: silowniaRef.current, side: 'left' as const, id: 'silownia' },
|
||||
{ el: cwiczacyRef.current, side: 'right' as const, id: 'cwiczacy' },
|
||||
{ el: adminRef.current, side: 'right' as const, id: 'admin' },
|
||||
];
|
||||
|
||||
const compute = () => {
|
||||
@@ -98,7 +101,9 @@ function HubDiagram() {
|
||||
y1: ((cy + (dy / len) * HUB_RADIUS) / cr.height) * 100,
|
||||
x2: (((t.side === 'left' ? r.right : r.left) - cr.left) / cr.width) * 100,
|
||||
y2: (midY / cr.height) * 100,
|
||||
delay: t.delay,
|
||||
// połowa podstawy trójkąta jako % wysokości kontenera
|
||||
spread: SPREAD_PX / cr.height,
|
||||
id: t.id,
|
||||
});
|
||||
}
|
||||
setWires(next);
|
||||
@@ -129,19 +134,27 @@ function HubDiagram() {
|
||||
preserveAspectRatio="none"
|
||||
className="absolute inset-0 h-full w-full"
|
||||
>
|
||||
<defs>
|
||||
{wires.map((w) => (
|
||||
<linearGradient
|
||||
key={w.id}
|
||||
id={`ray-${w.id}`}
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1={w.x1}
|
||||
y1={w.y1}
|
||||
x2={w.x2}
|
||||
y2={w.y2}
|
||||
>
|
||||
<stop offset="0" stopColor="var(--accent)" stopOpacity="0.6" />
|
||||
<stop offset="1" stopColor="var(--accent)" stopOpacity="0.05" />
|
||||
</linearGradient>
|
||||
))}
|
||||
</defs>
|
||||
{wires.map((w) => (
|
||||
<line
|
||||
key={`${w.x2}-${w.y2}`}
|
||||
className="link-line"
|
||||
style={{ animationDelay: w.delay }}
|
||||
x1={w.x1}
|
||||
y1={w.y1}
|
||||
x2={w.x2}
|
||||
y2={w.y2}
|
||||
vectorEffect="non-scaling-stroke"
|
||||
stroke="var(--accent)"
|
||||
strokeOpacity="0.45"
|
||||
strokeWidth="1.5"
|
||||
<polygon
|
||||
key={w.id}
|
||||
points={`${w.x1},${w.y1} ${w.x2},${w.y2 - w.spread} ${w.x2},${w.y2 + w.spread}`}
|
||||
fill={`url(#ray-${w.id})`}
|
||||
/>
|
||||
))}
|
||||
</svg>
|
||||
|
||||
@@ -154,18 +154,6 @@
|
||||
animation: streak-ignite 260ms var(--ease-out-quart) backwards;
|
||||
}
|
||||
|
||||
/* Rdzeń ekosystemu — przepływ po przerywanych wiązaniach */
|
||||
@keyframes dash-flow {
|
||||
to {
|
||||
stroke-dashoffset: -16;
|
||||
}
|
||||
}
|
||||
|
||||
.link-line {
|
||||
stroke-dasharray: 4 4;
|
||||
animation: dash-flow 1.4s linear infinite;
|
||||
}
|
||||
|
||||
/* Wejścia sekcji na scroll (IntersectionObserver dodaje .revealed) */
|
||||
.reveal {
|
||||
opacity: 0;
|
||||
@@ -276,10 +264,6 @@
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.link-line {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.reveal {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
|
||||
Reference in New Issue
Block a user