#!/usr/bin/env bash # Inspiration randomizer: generate N plates from random seeds, each named by its # seed, plus an HTML contact sheet to browse them. Because every parameter is # derived from the seed, picking a favourite just means noting its seed and # running: tools/render.sh # # Usage: tools/inspire.sh [count] [thumb_px] # tools/inspire.sh 32 600 set -e ROOT="$(cd "$(dirname "$0")/.." && pwd)" COUNT="${1:-24}" SIZE="${2:-600}" OUT="$ROOT/output/inspiration" mkdir -p "$OUT" WORDS=(MUON KAON PION LAMBDA SIGMA XI OMEGA TAU GLUON QUARK HADRON BARYON LEPTON \ NEUTRINO BOSON STRANGE CHARM HYPERON ANTIPROTON POSITRON MESON FERMION NUCLEON \ ISOSPIN CASCADE RESONANCE PARITY GLUEBALL PENTAQUARK PHOTON) SEEDS_FILE="$OUT/seeds.txt" : > "$SEEDS_FILE" echo "Generating $COUNT inspiration plates (${SIZE}px) → output/inspiration/" for ((i = 1; i <= COUNT; i++)); do W=${WORDS[$RANDOM % ${#WORDS[@]}]} N=$((RANDOM % 9000 + 1000)) SEED="$W-$N" "$ROOT/tools/shoot.sh" "$OUT/$SEED.png" "fromseed=1&seed=$SEED&size_px=$SIZE" >/dev/null echo "$SEED" >> "$SEEDS_FILE" printf " [%2d/%2d] %s\n" "$i" "$COUNT" "$SEED" done # Build the contact sheet SHEET="$OUT/index.html" { echo 'Bubble Chamber — inspiration' echo '' echo "

Bubble Chamber · inspiration · $(date +%Y-%m-%d)

" echo '

Click a seed to select it, then run tools/render.sh <SEED> for the print master.

' echo '
' while IFS= read -r S; do echo "
$Srender.sh $S
" done < "$SEEDS_FILE" echo '
' } > "$SHEET" echo "done. open: output/inspiration/index.html"