/**
 * 小球直径
 * font = mx+c [14, 24]
 */
const SIZE = [50, 90] as const;
const SIZE_S = 8;
const SIZE_M = 0.25;
const SIZE_C = 1.5;

const seed_text = ['有气\n无力', '容易\n犯困', '睡眠\n障碍', '消化\n不良', '肩颈\n腰痛', '掉\n头发', '记忆力\n下降'];
const seed_color = ['#367dd599', '#b1450399', '#34b10399', '#b1860399', '#03b19b99', '#b1a30399', '#34b10399'];

function getRandomValueWithStep(step: number, min: number, max: number) {
  step = Math.max(1, step);
  if (min > max) {
    [min, max] = [max, min];
  }

  const range = max - min;
  const steps = Math.floor(range / step) + 1;
  const random = Math.floor(Math.random() * steps);
  return min + random * step;
}

export default function () {
  const max = seed_text.length - 1;
  return seed_text.map((text, i) => {
    const diameter = getRandomValueWithStep(SIZE_S, ...SIZE);
    return {
      text,
      color: seed_color[i],
      diameter,
      size: Math.floor(diameter * SIZE_M + SIZE_C),
    };
  });
}
