@@ -23,13 +23,18 @@ import { vhsInterlace } from "~ext/live-effects/vhs-interlace.ts";
2323import { dataMosh } from "~ext/live-effects/data-mosh.ts" ;
2424import { waveDistortion } from "~ext/live-effects/wave-distortion.ts" ;
2525import { 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
2729import { compressor } from "~ext/live-effects/wips/compressor.ts" ;
2830import { imageReverbGPU } from "~ext/live-effects/wips/image-reverb-gpu.ts" ;
2931import { imageReverb } from "~ext/live-effects/wips/image-reverb.ts" ;
3032import { exprTube } from "~ext/live-effects/wips/tube.ts" ;
3133
3234const 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