Skip to content

Commit 95be77b

Browse files
committed
Split some code out of draw.ts; add Worker scaffold
1 parent 9661783 commit 95be77b

8 files changed

Lines changed: 397 additions & 319 deletions

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useMemo, useReducer, useRef, useState } from 'react'
22

33
import styled from 'styled-components'
4-
import { drawFrameIncrementally, drawFramePreview } from './draw'
4+
import { drawFrameIncrementally, drawFramePreview } from './draw/draw-frame'
55
import {
66
ClickedPath,
77
findClickedScreenOrPattern,

src/draw.ts

Lines changed: 0 additions & 317 deletions
This file was deleted.

src/draw/constants.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const MAX_QUEUE_SIZE = 1e6
2+
// const MIN_PATTERN_SIZE = 0.0005 // ignore patterns where either side is smaller than this
3+
export const MIN_PATTERN_SIZE_PX = 1 // ignore patterns where either side is smaller than this// -- constants
4+
const COLOR_SIZE = 50
5+
export const COLORS = Array(COLOR_SIZE)
6+
.fill(undefined)
7+
.map((_, i) => {
8+
const frac = i / COLOR_SIZE
9+
10+
const hue = (80 + 360 * frac) % 360
11+
const saturation = 50 + frac * 30
12+
const lightness = 60
13+
14+
return `hsl(${hue} ${saturation}% ${lightness}%)`
15+
})
16+
export const MIN_DEPTH = 3
17+
export const MAX_DEPTH = Infinity
18+
export const MAX_PREVIEW_DRAW_CALLS = 5e3 // number of shapes to draw per preview frame
19+
export const MAX_DRAW_TIME_MS = 15 // how long to draw a frame in ms
20+
export const DEBUG = true as boolean

0 commit comments

Comments
 (0)