leaderboard / src /components /CellPatternBackground.tsx
dbonet's picture paumateo's picture
Publish TabBioMed leaderboard
d189f56
Raw History Blame Contribute Delete
14.1 kB
import React from 'react';
interface CellPlacement {
motif: 'cell-1-1' | 'cell-0-1' | 'cell-1-2' | 'cell-0-2-pair' | 'cell-0-2-a' | 'cell-0-2-b';
x: number;
y: number;
rotate: number;
scale: number;
opacity: number;
}
const TILE_SIZE = 920;
const WRAP_MARGIN = 115;
/**
* Poisson-spaced organic microscopy field using ONLY the 4 living biological cells
* from the TabBioMed 3x3 logo (excluding Col 0 and Row 2 tabular squares).
* Every cell near a tile boundary wraps seamlessly across 920x920 edges.
*/
const PLACEMENTS: CellPlacement[] = [
{ motif: 'cell-1-2', x: 241.5, y: 47.2, rotate: 17, scale: 0.5, opacity: 0.79 },
{ motif: 'cell-0-1', x: 744.6, y: 212.2, rotate: -31, scale: 0.54, opacity: 0.84 },
{ motif: 'cell-0-1', x: 231.9, y: 775.8, rotate: 150, scale: 0.57, opacity: 0.81 },
{ motif: 'cell-0-2-pair', x: 900.0, y: 70.6, rotate: 69, scale: 0.58, opacity: 0.91 },
{ motif: 'cell-0-1', x: 898.3, y: 859.9, rotate: 127, scale: 0.51, opacity: 0.81 },
{ motif: 'cell-0-1', x: 387.3, y: 561.4, rotate: -56, scale: 0.49, opacity: 0.85 },
{ motif: 'cell-1-2', x: 571.1, y: 767.5, rotate: 147, scale: 0.57, opacity: 0.86 },
{ motif: 'cell-1-1', x: 744.6, y: 442.9, rotate: -137, scale: 0.54, opacity: 0.9 },
{ motif: 'cell-0-1', x: 112.6, y: 15.3, rotate: -85, scale: 0.49, opacity: 0.82 },
{ motif: 'cell-0-2-b', x: 571.7, y: 438.7, rotate: 124, scale: 0.61, opacity: 0.82 },
{ motif: 'cell-0-2-pair', x: 455.7, y: 163.2, rotate: 65, scale: 0.55, opacity: 0.94 },
{ motif: 'cell-0-2-pair', x: 16.9, y: 309.4, rotate: 117, scale: 0.53, opacity: 0.82 },
{ motif: 'cell-1-2', x: 593.1, y: 292.8, rotate: -159, scale: 0.52, opacity: 0.82 },
{ motif: 'cell-1-2', x: 243.1, y: 229.8, rotate: -106, scale: 0.53, opacity: 0.95 },
{ motif: 'cell-0-2-pair', x: 297.2, y: 401.1, rotate: -17, scale: 0.49, opacity: 0.95 },
{ motif: 'cell-1-2', x: 202.8, y: 548.7, rotate: -90, scale: 0.49, opacity: 0.85 },
{ motif: 'cell-0-1', x: 94.9, y: 196.5, rotate: 7, scale: 0.57, opacity: 0.8 },
{ motif: 'cell-0-2-pair', x: 638.6, y: 43.5, rotate: 79, scale: 0.49, opacity: 0.91 },
{ motif: 'cell-0-2-pair', x: 140.8, y: 370.0, rotate: -22, scale: 0.57, opacity: 0.84 },
{ motif: 'cell-0-1', x: 602.8, y: 621.2, rotate: 3, scale: 0.51, opacity: 0.94 },
{ motif: 'cell-0-1', x: 99.9, y: 707.5, rotate: 112, scale: 0.56, opacity: 0.96 },
{ motif: 'cell-0-1', x: 737.7, y: 758.4, rotate: -27, scale: 0.51, opacity: 0.83 },
{ motif: 'cell-1-2', x: 32.6, y: 568.3, rotate: -99, scale: 0.56, opacity: 0.84 },
{ motif: 'cell-1-1', x: 463.9, y: 25.4, rotate: 74, scale: 0.54, opacity: 0.83 },
{ motif: 'cell-1-2', x: 415.4, y: 410.1, rotate: 133, scale: 0.51, opacity: 0.92 },
{ motif: 'cell-1-1', x: 807.2, y: 663.4, rotate: -133, scale: 0.5, opacity: 0.88 },
{ motif: 'cell-1-2', x: 451.2, y: 818.4, rotate: -149, scale: 0.49, opacity: 0.91 },
{ motif: 'cell-0-2-pair', x: 465.7, y: 693.1, rotate: -68, scale: 0.56, opacity: 0.87 },
{ motif: 'cell-0-2-a', x: 737.2, y: 327.3, rotate: 4, scale: 0.55, opacity: 0.9 },
{ motif: 'cell-0-1', x: 391.8, y: 261.4, rotate: 121, scale: 0.5, opacity: 0.95 },
{ motif: 'cell-0-1', x: 280.7, y: 669.4, rotate: 36, scale: 0.52, opacity: 0.8 },
{ motif: 'cell-0-1', x: 26.0, y: 433.8, rotate: 81, scale: 0.58, opacity: 0.89 },
{ motif: 'cell-0-2-pair', x: 871.9, y: 205.5, rotate: 166, scale: 0.55, opacity: 0.88 },
{ motif: 'cell-1-1', x: 621.6, y: 163.5, rotate: 29, scale: 0.53, opacity: 0.82 },
{ motif: 'cell-0-1', x: 727.9, y: 570.8, rotate: -28, scale: 0.52, opacity: 0.96 },
{ motif: 'cell-0-1', x: 766.1, y: 20.3, rotate: 112, scale: 0.57, opacity: 0.8 },
{ motif: 'cell-1-2', x: 337.5, y: 873.0, rotate: 147, scale: 0.53, opacity: 0.81 },
{ motif: 'cell-0-1', x: 353.8, y: 97.6, rotate: 132, scale: 0.54, opacity: 0.82 },
{ motif: 'cell-0-2-b', x: 842.0, y: 517.9, rotate: 65, scale: 0.58, opacity: 0.87 },
{ motif: 'cell-0-2-a', x: 511.2, y: 545.9, rotate: -59, scale: 0.61, opacity: 0.96 },
{ motif: 'cell-1-1', x: 891.9, y: 742.4, rotate: 80, scale: 0.55, opacity: 0.83 },
{ motif: 'cell-1-1', x: 674.5, y: 854.9, rotate: 75, scale: 0.54, opacity: 0.94 },
{ motif: 'cell-1-2', x: 842.3, y: 378.3, rotate: 49, scale: 0.57, opacity: 0.94 },
{ motif: 'cell-1-2', x: 89.2, y: 822.6, rotate: -62, scale: 0.53, opacity: 0.9 },
{ motif: 'cell-1-2', x: 354.9, y: 756.7, rotate: -103, scale: 0.54, opacity: 0.84 },
];
function getWrappedPositions(x: number, y: number): Array<[number, number]> {
const xs = [x];
const ys = [y];
if (x < WRAP_MARGIN) xs.push(x + TILE_SIZE);
if (x > TILE_SIZE - WRAP_MARGIN) xs.push(x - TILE_SIZE);
if (y < WRAP_MARGIN) ys.push(y + TILE_SIZE);
if (y > TILE_SIZE - WRAP_MARGIN) ys.push(y - TILE_SIZE);
const pairs: Array<[number, number]> = [];
for (const px of xs) {
for (const py of ys) {
pairs.push([px, py]);
}
}
return pairs;
}
export const CellPatternBackground: React.FC = () => {
return (
<div className="cell-field-backdrop" aria-hidden="true">
<svg className="cell-field-svg" width="100%" height="100%">
<defs>
{/* Motif 1: [row 1, col 1] Living nucleated cell, centered at (390, 411) */}
<g id="tbm-motif-cell-1-1" strokeLinecap="round" strokeLinejoin="round">
<g transform="translate(-390, -411)">
<path
d="M 388,347 C 426,347 454,373 454,410 C 454,447 426.5,475 389,475 C 345,475 325,455 325,411 C 325,373.5 350,347 388,347 Z"
fill="var(--cell-pattern-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="9.5"
/>
<path
d="M 397,397 C 409.4,397 419.5,406.4 419.5,418 C 419.5,429.6 409.4,439 397,439 C 384.6,439 374.5,429.6 374.5,418 C 374.5,406.4 384.6,397 397,397 Z"
fill="var(--cell-pattern-nucleus-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="7.5"
/>
<circle cx="397.5" cy="418" r="4.8" fill="var(--cell-pattern-dot)" stroke="none" />
</g>
</g>
{/* Motif 2: [row 0, col 1] Earlier mitosis, centered at (391, 258) */}
<g id="tbm-motif-cell-0-1" strokeLinecap="round" strokeLinejoin="round">
<g transform="translate(-391, -258)">
<path
d="M 336.14,247.42 C 349.14,237.02 369.19,244.67 379.69,236.27 C 389.69,228.27 387.32,210.95 399.32,201.35 C 416.32,187.75 441.25,190.52 454.85,207.52 C 468.45,224.52 465.68,249.45 448.68,263.05 C 436.68,272.65 420.31,266.53 410.31,274.53 C 399.81,282.93 402.86,304.18 389.86,314.58 C 371.86,328.98 344.22,326.36 329.42,307.86 C 314.62,289.36 318.14,261.82 336.14,247.42 Z"
fill="var(--cell-pattern-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="9.5"
/>
<path
d="M 358.5,270.9 C 366.3,270.9 372.7,277 372.7,284.5 C 372.7,292 366.3,298.1 358.5,298.1 C 350.7,298.1 344.3,292 344.3,284.5 C 344.3,277 350.7,270.9 358.5,270.9 Z"
fill="var(--cell-pattern-nucleus-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="7"
/>
<path
d="M 428,216.7 C 435.1,216.7 440.8,222.2 440.8,229 C 440.8,235.8 435.1,241.3 428,241.3 C 420.9,241.3 415.2,235.8 415.2,229 C 415.2,222.2 420.9,216.7 428,216.7 Z"
fill="var(--cell-pattern-nucleus-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="7"
/>
<circle cx="358.5" cy="284.5" r="4" fill="var(--cell-pattern-dot)" stroke="none" />
<circle cx="428" cy="229" r="3.8" fill="var(--cell-pattern-dot)" stroke="none" />
</g>
</g>
{/* Motif 3: [row 1, col 2] Later asymmetric mitosis, centered at (543, 407) */}
<g id="tbm-motif-cell-1-2" strokeLinecap="round" strokeLinejoin="round">
<g transform="translate(-543, -407)">
<path
d="M 485.07,404.06 C 498.57,389.21 528.78,395.34 538.28,384.89 C 546.78,375.54 540.86,355.28 549.86,345.38 C 563.36,330.53 585.87,329.46 600.72,342.96 C 615.57,356.46 616.64,378.97 603.14,393.82 C 594.14,403.72 573.42,399.76 564.92,409.11 C 555.42,419.56 564.43,449.09 550.93,463.94 C 534.43,482.09 506.54,483.73 488.06,466.93 C 469.58,450.13 468.57,422.21 485.07,404.06 Z"
fill="var(--cell-pattern-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="9.5"
/>
<path
d="M 513.5,424.7 C 521.5,424.7 528,430.9 528,438.5 C 528,446.1 521.5,452.3 513.5,452.3 C 505.5,452.3 499,446.1 499,438.5 C 499,430.9 505.5,424.7 513.5,424.7 Z"
fill="var(--cell-pattern-nucleus-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="7"
/>
<path
d="M 580,354.5 C 586.6,354.5 592,359.6 592,366 C 592,372.4 586.6,377.5 580,377.5 C 573.4,377.5 568,372.4 568,366 C 568,359.6 573.4,354.5 580,354.5 Z"
fill="var(--cell-pattern-nucleus-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="6.8"
/>
<circle cx="513.5" cy="438.5" r="4" fill="var(--cell-pattern-dot)" stroke="none" />
<circle cx="580" cy="366" r="3.7" fill="var(--cell-pattern-dot)" stroke="none" />
</g>
</g>
{/* Motif 4: [row 0, col 2] Divided sister pair, centered at (555, 245) */}
<g id="tbm-motif-cell-0-2-pair" strokeLinecap="round" strokeLinejoin="round">
<g transform="translate(-555, -245)">
<path
d="M 525,232 C 543,232 568,257 568,275 C 568,299 549,318 525,318 C 501,318 482,299 482,275 C 482,251 501,232 525,232 Z"
fill="var(--cell-pattern-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="9.5"
/>
<path
d="M 515,254.5 C 523.4,254.5 530.2,261 530.2,269 C 530.2,277 523.4,283.5 515,283.5 C 506.6,283.5 499.8,277 499.8,269 C 499.8,261 506.6,254.5 515,254.5 Z"
fill="var(--cell-pattern-nucleus-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="7.2"
/>
<path
d="M 592.5,172 C 612.1,172 628,187.9 628,207.5 C 628,227.1 612.1,243 592.5,243 C 578,243 557,222 557,207.5 C 557,187.9 572.9,172 592.5,172 Z"
fill="var(--cell-pattern-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="9.5"
/>
<path
d="M 597,191.3 C 604.1,191.3 609.8,196.8 609.8,203.5 C 609.8,210.2 604.1,215.7 597,215.7 C 589.9,215.7 584.2,210.2 584.2,203.5 C 584.2,196.8 589.9,191.3 597,191.3 Z"
fill="var(--cell-pattern-nucleus-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="7"
/>
<circle cx="515" cy="269" r="4.2" fill="var(--cell-pattern-dot)" stroke="none" />
<circle cx="597" cy="203.5" r="3.8" fill="var(--cell-pattern-dot)" stroke="none" />
</g>
</g>
{/* Motif 5a & 5b: Single daughter cells from [row 0, col 2] */}
<g id="tbm-motif-cell-0-2-a" strokeLinecap="round" strokeLinejoin="round">
<g transform="translate(-525, -275)">
<path
d="M 525,232 C 543,232 568,257 568,275 C 568,299 549,318 525,318 C 501,318 482,299 482,275 C 482,251 501,232 525,232 Z"
fill="var(--cell-pattern-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="9.5"
/>
<path
d="M 515,254.5 C 523.4,254.5 530.2,261 530.2,269 C 530.2,277 523.4,283.5 515,283.5 C 506.6,283.5 499.8,277 499.8,269 C 499.8,261 506.6,254.5 515,254.5 Z"
fill="var(--cell-pattern-nucleus-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="7.2"
/>
<circle cx="515" cy="269" r="4.2" fill="var(--cell-pattern-dot)" stroke="none" />
</g>
</g>
<g id="tbm-motif-cell-0-2-b" strokeLinecap="round" strokeLinejoin="round">
<g transform="translate(-592.5, -207.5)">
<path
d="M 592.5,172 C 612.1,172 628,187.9 628,207.5 C 628,227.1 612.1,243 592.5,243 C 578,243 557,222 557,207.5 C 557,187.9 572.9,172 592.5,172 Z"
fill="var(--cell-pattern-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="9.5"
/>
<path
d="M 597,191.3 C 604.1,191.3 609.8,196.8 609.8,203.5 C 609.8,210.2 604.1,215.7 597,215.7 C 589.9,215.7 584.2,210.2 584.2,203.5 C 584.2,196.8 589.9,191.3 597,191.3 Z"
fill="var(--cell-pattern-nucleus-fill)"
stroke="var(--cell-pattern-stroke)"
strokeWidth="7"
/>
<circle cx="597" cy="203.5" r="3.8" fill="var(--cell-pattern-dot)" stroke="none" />
</g>
</g>
<pattern
id="tbm-organic-cell-pattern"
width={TILE_SIZE}
height={TILE_SIZE}
patternUnits="userSpaceOnUse"
>
{PLACEMENTS.flatMap((cell, idx) =>
getWrappedPositions(cell.x, cell.y).map(([wx, wy], wIdx) => (
<use
key={`${idx}-${wIdx}`}
href={`#tbm-motif-${cell.motif}`}
transform={`translate(${wx}, ${wy}) rotate(${cell.rotate}) scale(${cell.scale})`}
opacity={cell.opacity}
/>
))
)}
</pattern>
</defs>
<rect width="100%" height="100%" fill="url(#tbm-organic-cell-pattern)" />
</svg>
</div>
);
};