Default complexity level to 2. (#55)

This fixes #53.  Note that this means the eye creature isn't observable from the UI, as moving the slider to "bonkers" shows the eye with parts randomly replaced.  The "pristine" eye creature can still be shown for debugging purposes by adding `&eye=on` to the end of the URL.
pull/58/head
Atul Varma 2021-03-22 20:54:01 -04:00 zatwierdzone przez GitHub
rodzic 233dbc379d
commit 059c0528c7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 11 dodań i 3 usunięć

Wyświetl plik

@ -249,6 +249,8 @@ const COMPLEXITY_LEVEL_GENERATORS: CreatureGenerator[] = [
const MAX_COMPLEXITY_LEVEL = COMPLEXITY_LEVEL_GENERATORS.length - 1;
const INITIAL_COMPLEXITY_LEVEL = 2;
function getDownloadFilename(randomSeed: number | null) {
let downloadBasename = "mystic-symbolic-creature";
@ -261,11 +263,17 @@ function getDownloadFilename(randomSeed: number | null) {
export const CreaturePage: React.FC<{}> = () => {
const svgRef = useRef<SVGSVGElement>(null);
const qs = new URLSearchParams(window.location.search);
const showEyeCreature = qs.get("eye") === "on";
const [bgColor, setBgColor] = useState(DEFAULT_BG_COLOR);
const [randomSeed, setRandomSeed] = useState<number | null>(null);
const [randomlyInvert, setRandomlyInvert] = useState(false);
const [randomSeed, setRandomSeed] = useState<number | null>(
showEyeCreature ? null : Date.now()
);
const [randomlyInvert, setRandomlyInvert] = useState(true);
const [symbolCtx, setSymbolCtx] = useState(createSvgSymbolContext());
const [complexity, setComplexity] = useState(MAX_COMPLEXITY_LEVEL);
const [complexity, setComplexity] = useState(
showEyeCreature ? MAX_COMPLEXITY_LEVEL : INITIAL_COMPLEXITY_LEVEL
);
const defaultCtx = useContext(CreatureContext);
const newRandomSeed = () => setRandomSeed(Date.now());
const ctx: CreatureContextType = {