Фотография
нажмите — покажем
нажмите — покажем
Нужно выровнят блоки, количество блоков динамично
Текушая функция генерации позиций:
const HUB_RADIUS = 32; // half of hub's 64px width
const ORB_RADIUS = 32; // half of orb's 64px width
const MIN_GAP = 56; // breathing room between hub edge and orb edge
const MAX_GROWTH_RATIO = 0.35; // spiral never grows past +35% of base radius
function getSpiralPosition(index: number, total: number) {
const angleStep = (2 * Math.PI) / total;
const angle = index * angleStep - Math.PI / 2;
const baseRadius = HUB_RADIUS + ORB_RADIUS + MIN_GAP;
// Growth is normalized 0 → 1 across all items, then capped at
// MAX_GROWTH_RATIO of baseRadius — last item never overshoots.
const growthFactor = total > 1 ? index / (total - 1) : 0;
const radius = baseRadius * (1 + growthFactor * MAX_GROWTH_RATIO);
return {
x: Math.cos(angle) * radius,
y: Math.sin(angle) * radius,
};
}