Skip to content

Commit 22d7002

Browse files
committed
fixes
1 parent 13664ae commit 22d7002

17 files changed

Lines changed: 8343 additions & 5482 deletions

File tree

pkgs/ai-deno/effect-checker/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
<div style="display: flex; padding: 8px">
1919
<div id="controls" style="flex: none"></div>
2020
<div>
21+
<div>
22+
<button type="button" id="img-source-1">Source 1</button>
23+
<button type="button" id="img-source-2">Source 2</button>
24+
</div>
2125
<span
2226
id="size-label"
2327
style="
2.3 MB
Loading

pkgs/ai-deno/effect-checker/src/index.tsx

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,18 @@ import { vhsInterlace } from "~ext/live-effects/vhs-interlace.ts";
2323
import { dataMosh } from "~ext/live-effects/data-mosh.ts";
2424
import { waveDistortion } from "~ext/live-effects/wave-distortion.ts";
2525
import { selectiveColorCorrection } from "~ext/live-effects/selective-color-correction.ts";
26+
import { husky } from "~ext/live-effects/husky.ts";
27+
import { cosmicWaves } from "~ext/live-effects/extra/cosmic-waves.ts";
2628

2729
import { compressor } from "~ext/live-effects/wips/compressor.ts";
2830
import { imageReverbGPU } from "~ext/live-effects/wips/image-reverb-gpu.ts";
2931
import { imageReverb } from "~ext/live-effects/wips/image-reverb.ts";
3032
import { exprTube } from "~ext/live-effects/wips/tube.ts";
3133

3234
const plugins = [
35+
chromaticAberration,
36+
husky,
37+
cosmicWaves,
3338
exprTube,
3439
gaussianBlur,
3540
dithering,
@@ -50,7 +55,6 @@ const plugins = [
5055
outline,
5156
// innerGlow,
5257
testBlueFill,
53-
chromaticAberration,
5458
directionalBlur,
5559
];
5660

@@ -92,6 +96,7 @@ function Controls({
9296
const [params, setParams] = useState<any>(getInitialParams(currentPlugin));
9397
const [dpi, setDpi] = useState(72);
9498
const [paused, setPaused] = useState(false);
99+
const [isPreviewMode, setPreviewMode] = useState(false);
95100

96101
const pausedRef = useThroughRef(paused);
97102
const paramsRef = useThroughRef(params);
@@ -105,9 +110,32 @@ function Controls({
105110
useEffect(() => {
106111
setParams(getInitialParams(currentPlugin));
107112

113+
const source1Btn = document.getElementById("img-source-1")!;
114+
const source2Btn = document.getElementById("img-source-2")!;
115+
108116
const abort = new AbortController();
109117
const signal = abort.signal;
110118

119+
source1Btn.addEventListener(
120+
"click",
121+
async () => {
122+
const response = await fetch("./source.png");
123+
const blob = await response.blob();
124+
await onLoadImage(blob);
125+
},
126+
{ signal }
127+
);
128+
129+
source2Btn.addEventListener(
130+
"click",
131+
async () => {
132+
const response = await fetch("./source2.png");
133+
const blob = await response.blob();
134+
await onLoadImage(blob);
135+
},
136+
{ signal }
137+
);
138+
111139
window.addEventListener("dragover", (e) => e.preventDefault(), { signal });
112140

113141
window.addEventListener(
@@ -204,6 +232,7 @@ function Controls({
204232
{
205233
dpi: dpiRef.current,
206234
baseDpi: 72,
235+
isInPreview: isPreviewMode,
207236
}
208237
);
209238
if (signal.aborted) return;
@@ -256,7 +285,7 @@ function Controls({
256285
cancelAnimationFrame(animId);
257286
abort.abort();
258287
};
259-
}, [currentPlugin]);
288+
}, [currentPlugin, isPreviewMode]);
260289

261290
const onParamChanged = useEventCallback((key, value) => {
262291
const nextParams = { ...params, [key]: value };
@@ -505,6 +534,15 @@ function Controls({
505534
</select>
506535
</label>
507536

537+
<label>
538+
<input
539+
type="checkbox"
540+
checked={isPreviewMode}
541+
onChange={(e) => setPreviewMode(e.currentTarget.checked)}
542+
/>
543+
Preview mode
544+
</label>
545+
508546
<button
509547
onClick={() => {
510548
pausedRef.current = !pausedRef.current;

0 commit comments

Comments
 (0)