textmode.filters.js 1.1.1 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,7 +30,7 @@
30
30
  *
31
31
  * @module textmode.filters.js
32
32
  */
33
- import type { TextmodePlugin } from 'textmode.js/plugins';
33
+ import type { TextmodePlugin } from 'textmode.js';
34
34
  export type { BrightnessOptions, ContrastOptions, SaturationOptions, HueRotateOptions, PosterizeOptions, ChromaticAberrationOptions, PixelateOptions, GridDistortionOptions, GlitchOptions, CrtMattiasOptions, ScanlinesOptions, VignetteOptions, BloomOptions, FilmGrainOptions, } from './types';
35
35
  /**
36
36
  * GPU-accelerated image filters plugin for textmode.js.
@@ -39,36 +39,7 @@ export type { BrightnessOptions, ContrastOptions, SaturationOptions, HueRotateOp
39
39
  * visual effects that run entirely on the GPU via WebGL2 fragment shaders.
40
40
  *
41
41
  * @example
42
- * ```javascript
43
- * import { textmode } from 'textmode.js';
44
- * import { FiltersPlugin } from 'textmode.filters.js';
45
- *
46
- * const t = textmode.create({
47
- * plugins: [FiltersPlugin]
48
- * });
49
- *
50
- * let frame = 0;
51
- * t.draw(() => {
52
- * // Simple filter with shorthand value
53
- * t.layers.base.filter('brightness', 1.2);
54
- *
55
- * // Filter with options object
56
- * t.layers.base.filter('bloom', {
57
- * threshold: 0.5,
58
- * intensity: 1.5,
59
- * radius: 8
60
- * });
61
- *
62
- * // Animated filter
63
- * t.layers.base.filter('filmGrain', {
64
- * intensity: 0.2,
65
- * time: frame * 0.016
66
- * });
67
- *
68
- * t.background(0);
69
- * frame++;
70
- * });
71
- * ```
42
+ * {@includeCode ../examples/brightness/sketch.js}
72
43
  */
73
44
  export declare const FiltersPlugin: TextmodePlugin;
74
45
  /**
@@ -91,3 +62,10 @@ export declare const FiltersPlugin: TextmodePlugin;
91
62
  * @returns A textmode.js plugin instance.
92
63
  */
93
64
  export declare const createFiltersPlugin: () => TextmodePlugin;
65
+ declare global {
66
+ interface Window {
67
+ FiltersPlugin?: TextmodePlugin;
68
+ createFiltersPlugin?: typeof createFiltersPlugin;
69
+ }
70
+ }
71
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,YAAY,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,0BAA0B,EAC1B,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,GAChB,MAAM,SAAS,CAAC;AAoBjB;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,cAmF3B,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,QAAO,cAA+B,CAAC;AAEvE,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,aAAa,CAAC,EAAE,cAAc,CAAC;QAC/B,mBAAmB,CAAC,EAAE,OAAO,mBAAmB,CAAC;KACjD;CACD"}
@@ -4,41 +4,9 @@
4
4
  * Each filter can be applied using either:
5
5
  * - A single value (shorthand for the primary parameter)
6
6
  * - An options object with named parameters
7
+ *
7
8
  * @example
8
- * ```javascript
9
- * const t = textmode.create({
10
- * width: window.innerWidth,
11
- * height: window.innerHeight,
12
- * plugins: [FiltersPlugin],
13
- * });
14
- *
15
- * let video;
16
- *
17
- * t.setup(async () => {
18
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
19
- * video.play();
20
- * video.loop();
21
- * video.characters(' .:-=+*#%@');
22
- * });
23
- *
24
- * t.draw(() => {
25
- * t.background(0);
26
- * if (video) {
27
- * t.image(video, t.grid.cols, t.grid.rows);
28
- * }
29
- *
30
- * const wobble = Math.sin(t.secs * 2);
31
- * t.layers.base.filter('bloom', {
32
- * threshold: 0.5,
33
- * intensity: 1 + wobble * 0.35,
34
- * radius: 6 + wobble * 2,
35
- * });
36
- * });
37
- *
38
- * t.windowResized(() => {
39
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
40
- * });
41
- * ```
9
+ * {@includeCode ../examples/bloom/sketch.js}
42
10
  *
43
11
  * @module
44
12
  */
@@ -46,39 +14,9 @@
46
14
  * Configuration options for the `'brightness'` filter.
47
15
  *
48
16
  * Adjusts image brightness by multiplying pixel values.
17
+ *
49
18
  * @example
50
- * ```javascript
51
- * const t = textmode.create({
52
- * width: window.innerWidth,
53
- * height: window.innerHeight,
54
- * plugins: [FiltersPlugin],
55
- * });
56
- *
57
- * let video;
58
- *
59
- * t.setup(async () => {
60
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
61
- * video.play();
62
- * video.loop();
63
- * video.characters(' .:-=+*#%@');
64
- * });
65
- *
66
- * t.draw(() => {
67
- * t.background(0);
68
- * if (video) {
69
- * t.image(video, t.grid.cols, t.grid.rows);
70
- * }
71
- *
72
- * const wobble = Math.sin(t.secs * 2);
73
- * t.layers.base.filter('brightness', {
74
- * amount: 1 + wobble * 0.25,
75
- * });
76
- * });
77
- *
78
- * t.windowResized(() => {
79
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
80
- * });
81
- * ```
19
+ * {@includeCode ../examples/brightness/sketch.js}
82
20
  *
83
21
  * @category Color adjustment filters
84
22
  */
@@ -99,39 +37,9 @@ export interface BrightnessOptions {
99
37
  * Configuration options for the `'contrast'` filter.
100
38
  *
101
39
  * Adjusts image contrast by scaling pixel values around mid-gray.
40
+ *
102
41
  * @example
103
- * ```javascript
104
- * const t = textmode.create({
105
- * width: window.innerWidth,
106
- * height: window.innerHeight,
107
- * plugins: [FiltersPlugin],
108
- * });
109
- *
110
- * let video;
111
- *
112
- * t.setup(async () => {
113
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
114
- * video.play();
115
- * video.loop();
116
- * video.characters(' .:-=+*#%@');
117
- * });
118
- *
119
- * t.draw(() => {
120
- * t.background(0);
121
- * if (video) {
122
- * t.image(video, t.grid.cols, t.grid.rows);
123
- * }
124
- *
125
- * const wobble = Math.sin(t.secs * 2);
126
- * t.layers.base.filter('contrast', {
127
- * amount: 1 + wobble * 0.35,
128
- * });
129
- * });
130
- *
131
- * t.windowResized(() => {
132
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
133
- * });
134
- * ```
42
+ * {@includeCode ../examples/contrast/sketch.js}
135
43
  *
136
44
  * @category Color adjustment filters
137
45
  */
@@ -153,39 +61,9 @@ export interface ContrastOptions {
153
61
  *
154
62
  * Adjusts color intensity without affecting luminance.
155
63
  * Perfect for creating vivid, oversaturated looks or desaturating to grayscale.
64
+ *
156
65
  * @example
157
- * ```javascript
158
- * const t = textmode.create({
159
- * width: window.innerWidth,
160
- * height: window.innerHeight,
161
- * plugins: [FiltersPlugin],
162
- * });
163
- *
164
- * let video;
165
- *
166
- * t.setup(async () => {
167
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
168
- * video.play();
169
- * video.loop();
170
- * video.characters(' .:-=+*#%@');
171
- * });
172
- *
173
- * t.draw(() => {
174
- * t.background(0);
175
- * if (video) {
176
- * t.image(video, t.grid.cols, t.grid.rows);
177
- * }
178
- *
179
- * const wobble = Math.sin(t.secs * 2);
180
- * t.layers.base.filter('saturation', {
181
- * amount: 1 + wobble * 0.45,
182
- * });
183
- * });
184
- *
185
- * t.windowResized(() => {
186
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
187
- * });
188
- * ```
66
+ * {@includeCode ../examples/saturation/sketch.js}
189
67
  *
190
68
  * @category Color adjustment filters
191
69
  */
@@ -206,40 +84,9 @@ export interface SaturationOptions {
206
84
  *
207
85
  * Shifts all colors around the color wheel by a specified angle.
208
86
  * Useful for color grading or creating surreal color effects.
87
+ *
209
88
  * @example
210
- * ```javascript
211
- * const t = textmode.create({
212
- * width: window.innerWidth,
213
- * height: window.innerHeight,
214
- * plugins: [FiltersPlugin],
215
- * });
216
- *
217
- * let video;
218
- *
219
- * t.setup(async () => {
220
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
221
- * video.play();
222
- * video.loop();
223
- * video.characters(' .:-=+*#%@');
224
- * });
225
- *
226
- * t.draw(() => {
227
- * t.background(0);
228
- * if (video) {
229
- * t.image(video, t.grid.cols, t.grid.rows);
230
- * }
231
- *
232
- * const wobble = Math.sin(t.secs * 2);
233
- * const hue = (t.frameCount * 2 + wobble * 45) % 360;
234
- * t.layers.base.filter('hueRotate', {
235
- * angle: hue,
236
- * });
237
- * });
238
- *
239
- * t.windowResized(() => {
240
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
241
- * });
242
- * ```
89
+ * {@includeCode ../examples/hueRotate/sketch.js}
243
90
  *
244
91
  * @category Color adjustment filters
245
92
  */
@@ -262,39 +109,9 @@ export interface HueRotateOptions {
262
109
  *
263
110
  * Reduces the color palette to a limited number of bands per channel,
264
111
  * creating a retro quantized/poster-like look.
112
+ *
265
113
  * @example
266
- * ```javascript
267
- * const t = textmode.create({
268
- * width: window.innerWidth,
269
- * height: window.innerHeight,
270
- * plugins: [FiltersPlugin],
271
- * });
272
- *
273
- * let video;
274
- *
275
- * t.setup(async () => {
276
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
277
- * video.play();
278
- * video.loop();
279
- * video.characters(' .:-=+*#%@');
280
- * });
281
- *
282
- * t.draw(() => {
283
- * t.background(0);
284
- * if (video) {
285
- * t.image(video, t.grid.cols, t.grid.rows);
286
- * }
287
- *
288
- * const wobble = Math.sin(t.secs * 2);
289
- * t.layers.base.filter('posterize', {
290
- * levels: Math.max(2, Math.round(5 + wobble * 3)),
291
- * });
292
- * });
293
- *
294
- * t.windowResized(() => {
295
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
296
- * });
297
- * ```
114
+ * {@includeCode ../examples/posterize/sketch.js}
298
115
  *
299
116
  * @category Color adjustment filters
300
117
  */
@@ -318,40 +135,9 @@ export interface PosterizeOptions {
318
135
  *
319
136
  * RGB color channel separation effect that simulates lens distortion
320
137
  * found in cheap cameras or creates stylized glitch aesthetics.
138
+ *
321
139
  * @example
322
- * ```javascript
323
- * const t = textmode.create({
324
- * width: window.innerWidth,
325
- * height: window.innerHeight,
326
- * plugins: [FiltersPlugin],
327
- * });
328
- *
329
- * let video;
330
- *
331
- * t.setup(async () => {
332
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
333
- * video.play();
334
- * video.loop();
335
- * video.characters(' .:-=+*#%@');
336
- * });
337
- *
338
- * t.draw(() => {
339
- * t.background(0);
340
- * if (video) {
341
- * t.image(video, t.grid.cols, t.grid.rows);
342
- * }
343
- *
344
- * const wobble = Math.sin(t.secs * 2);
345
- * t.layers.base.filter('chromaticAberration', {
346
- * amount: 6 + wobble * 4,
347
- * direction: [Math.sin(t.secs), Math.cos(t.secs)],
348
- * });
349
- * });
350
- *
351
- * t.windowResized(() => {
352
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
353
- * });
354
- * ```
140
+ * {@includeCode ../examples/chromaticAberration/sketch.js}
355
141
  *
356
142
  * @category Distortion filters
357
143
  */
@@ -382,39 +168,9 @@ export interface ChromaticAberrationOptions {
382
168
  *
383
169
  * Reduces image resolution to create a mosaic/pixelated effect
384
170
  * reminiscent of retro video games or censored content.
171
+ *
385
172
  * @example
386
- * ```javascript
387
- * const t = textmode.create({
388
- * width: window.innerWidth,
389
- * height: window.innerHeight,
390
- * plugins: [FiltersPlugin],
391
- * });
392
- *
393
- * let video;
394
- *
395
- * t.setup(async () => {
396
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
397
- * video.play();
398
- * video.loop();
399
- * video.characters(' .:-=+*#%@');
400
- * });
401
- *
402
- * t.draw(() => {
403
- * t.background(0);
404
- * if (video) {
405
- * t.image(video, t.grid.cols, t.grid.rows);
406
- * }
407
- *
408
- * const wobble = Math.sin(t.secs * 2);
409
- * t.layers.base.filter('pixelate', {
410
- * pixelSize: 6 + wobble * 3,
411
- * });
412
- * });
413
- *
414
- * t.windowResized(() => {
415
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
416
- * });
417
- * ```
173
+ * {@includeCode ../examples/pixelate/sketch.js}
418
174
  *
419
175
  * @category Distortion filters
420
176
  */
@@ -439,47 +195,9 @@ export interface PixelateOptions {
439
195
  *
440
196
  * This filter is designed specifically for textmode.js grids, allowing
441
197
  * you to create dynamic text distortion effects.
198
+ *
442
199
  * @example
443
- * ```javascript
444
- * const t = textmode.create({
445
- * width: window.innerWidth,
446
- * height: window.innerHeight,
447
- * plugins: [FiltersPlugin],
448
- * });
449
- *
450
- * let video;
451
- *
452
- * t.setup(async () => {
453
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
454
- * video.play();
455
- * video.loop();
456
- * video.characters(' .:-=+*#%@');
457
- * });
458
- *
459
- * t.draw(() => {
460
- * t.background(0);
461
- * if (video) {
462
- * t.image(video, t.grid.cols, t.grid.rows);
463
- * }
464
- *
465
- * const wobble = Math.sin(t.secs * 2);
466
- * const widthFactors = Array.from({ length: t.grid.cols }, (_, i) => (Math.sin(i * 0.18 + t.frameCount * 0.04) + 1) * 0.5);
467
- * const heightFactors = Array.from({ length: t.grid.rows }, (_, i) => (Math.sin(i * 0.24 + t.secs * 1.5) + 1) * 0.5);
468
- * t.layers.base.filter('gridDistortion', {
469
- * gridCellDimensions: [t.grid.cols, t.grid.rows],
470
- * gridPixelDimensions: [t.grid.width, t.grid.height],
471
- * gridOffsetDimensions: [t.grid.offsetX, t.grid.offsetY],
472
- * widthFactors,
473
- * heightFactors,
474
- * widthVariationScale: 0.35 + wobble * 0.15,
475
- * heightVariationScale: 0.35 + wobble * 0.15,
476
- * });
477
- * });
478
- *
479
- * t.windowResized(() => {
480
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
481
- * });
482
- * ```
200
+ * {@includeCode ../examples/gridDistortion/sketch.js}
483
201
  *
484
202
  * @category Distortion filters
485
203
  */
@@ -557,39 +275,9 @@ export interface GridDistortionOptions {
557
275
  *
558
276
  * Digital glitch effect with RGB channel separation, scanlines, and noise.
559
277
  * Creates a corrupted/broken digital signal aesthetic.
278
+ *
560
279
  * @example
561
- * ```javascript
562
- * const t = textmode.create({
563
- * width: window.innerWidth,
564
- * height: window.innerHeight,
565
- * plugins: [FiltersPlugin],
566
- * });
567
- *
568
- * let video;
569
- *
570
- * t.setup(async () => {
571
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
572
- * video.play();
573
- * video.loop();
574
- * video.characters(' .:-=+*#%@');
575
- * });
576
- *
577
- * t.draw(() => {
578
- * t.background(0);
579
- * if (video) {
580
- * t.image(video, t.grid.cols, t.grid.rows);
581
- * }
582
- *
583
- * const wobble = Math.sin(t.secs * 2);
584
- * t.layers.base.filter('glitch', {
585
- * amount: Math.max(0, 0.2 + wobble * 0.8),
586
- * });
587
- * });
588
- *
589
- * t.windowResized(() => {
590
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
591
- * });
592
- * ```
280
+ * {@includeCode ../examples/glitch/sketch.js}
593
281
  *
594
282
  * @category Stylization filters
595
283
  */
@@ -611,41 +299,9 @@ export interface GlitchOptions {
611
299
  * CRT monitor emulation effect with screen curvature, animated scanlines,
612
300
  * blur, vignette, and film grain noise. Based on Mattias Gustavsson's
613
301
  * classic CRT shader.
302
+ *
614
303
  * @example
615
- * ```javascript
616
- * const t = textmode.create({
617
- * width: window.innerWidth,
618
- * height: window.innerHeight,
619
- * plugins: [FiltersPlugin],
620
- * });
621
- *
622
- * let video;
623
- *
624
- * t.setup(async () => {
625
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
626
- * video.play();
627
- * video.loop();
628
- * video.characters(' .:-=+*#%@');
629
- * });
630
- *
631
- * t.draw(() => {
632
- * t.background(0);
633
- * if (video) {
634
- * t.image(video, t.grid.cols, t.grid.rows);
635
- * }
636
- *
637
- * const wobble = Math.sin(t.secs * 2);
638
- * t.layers.base.filter('crtMattias', {
639
- * curvature: 0.45 + wobble * 0.1,
640
- * scanSpeed: 1 + wobble * 0.25,
641
- * time: t.secs,
642
- * });
643
- * });
644
- *
645
- * t.windowResized(() => {
646
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
647
- * });
648
- * ```
304
+ * {@includeCode ../examples/crtMattias/sketch.js}
649
305
  *
650
306
  * @see {@link https://github.com/libretro/glsl-shaders/blob/master/crt/shaders/crt-mattias.glsl | Original shader by Mattias Gustavsson}
651
307
  *
@@ -686,43 +342,9 @@ export interface CrtMattiasOptions {
686
342
  * A standalone scanline effect that adds horizontal lines to the image
687
343
  * to simulate a CRT display or old monitor. More customizable than
688
344
  * the scanlines in crtMattias.
345
+ *
689
346
  * @example
690
- * ```javascript
691
- * const t = textmode.create({
692
- * width: window.innerWidth,
693
- * height: window.innerHeight,
694
- * plugins: [FiltersPlugin],
695
- * });
696
- *
697
- * let video;
698
- *
699
- * t.setup(async () => {
700
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
701
- * video.play();
702
- * video.loop();
703
- * video.characters(' .:-=+*#%@');
704
- * });
705
- *
706
- * t.draw(() => {
707
- * t.background(0);
708
- * if (video) {
709
- * t.image(video, t.grid.cols, t.grid.rows);
710
- * }
711
- *
712
- * const wobble = Math.sin(t.secs * 2);
713
- * t.layers.base.filter('scanlines', {
714
- * count: 256,
715
- * lineWidth: 0.5,
716
- * intensity: 0.7 + wobble * 0.1,
717
- * speed: 1 + wobble * 0.15,
718
- * time: t.secs,
719
- * });
720
- * });
721
- *
722
- * t.windowResized(() => {
723
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
724
- * });
725
- * ```
347
+ * {@includeCode ../examples/scanlines/sketch.js}
726
348
  *
727
349
  * @category Stylization filters
728
350
  */
@@ -781,41 +403,9 @@ export interface ScanlinesOptions {
781
403
  *
782
404
  * Darkens the edges and corners of the image, drawing focus to the center.
783
405
  * Useful for creating a cinematic look or highlighting central content.
406
+ *
784
407
  * @example
785
- * ```javascript
786
- * const t = textmode.create({
787
- * width: window.innerWidth,
788
- * height: window.innerHeight,
789
- * plugins: [FiltersPlugin],
790
- * });
791
- *
792
- * let video;
793
- *
794
- * t.setup(async () => {
795
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
796
- * video.play();
797
- * video.loop();
798
- * video.characters(' .:-=+*#%@');
799
- * });
800
- *
801
- * t.draw(() => {
802
- * t.background(0);
803
- * if (video) {
804
- * t.image(video, t.grid.cols, t.grid.rows);
805
- * }
806
- *
807
- * const wobble = Math.sin(t.secs * 2);
808
- * t.layers.base.filter('vignette', {
809
- * amount: 0.5 + wobble * 0.2,
810
- * softness: 0.5,
811
- * roundness: 0.5 + wobble * 0.15,
812
- * });
813
- * });
814
- *
815
- * t.windowResized(() => {
816
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
817
- * });
818
- * ```
408
+ * {@includeCode ../examples/vignette/sketch.js}
819
409
  *
820
410
  * @category Stylization filters
821
411
  */
@@ -857,41 +447,9 @@ export interface VignetteOptions {
857
447
  * Creates a glow effect around bright areas of the image. Pixels above
858
448
  * the brightness threshold emit a soft glow that spreads outward.
859
449
  * Perfect for creating neon, glowing text, or dreamy effects.
450
+ *
860
451
  * @example
861
- * ```javascript
862
- * const t = textmode.create({
863
- * width: window.innerWidth,
864
- * height: window.innerHeight,
865
- * plugins: [FiltersPlugin],
866
- * });
867
- *
868
- * let video;
869
- *
870
- * t.setup(async () => {
871
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
872
- * video.play();
873
- * video.loop();
874
- * video.characters(' .:-=+*#%@');
875
- * });
876
- *
877
- * t.draw(() => {
878
- * t.background(0);
879
- * if (video) {
880
- * t.image(video, t.grid.cols, t.grid.rows);
881
- * }
882
- *
883
- * const wobble = Math.sin(t.secs * 2);
884
- * t.layers.base.filter('bloom', {
885
- * threshold: 0.5,
886
- * intensity: 1.2 + wobble * 0.5,
887
- * radius: 6 + wobble * 2,
888
- * });
889
- * });
890
- *
891
- * t.windowResized(() => {
892
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
893
- * });
894
- * ```
452
+ * {@includeCode ../examples/bloom/sketch.js}
895
453
  *
896
454
  * @category Stylization filters
897
455
  */
@@ -936,42 +494,9 @@ export interface BloomOptions {
936
494
  * film stock or analog video. The multi-layered noise creates an organic,
937
495
  * moving grain pattern that's less visible in darker areas, mimicking
938
496
  * real film characteristics.
497
+ *
939
498
  * @example
940
- * ```javascript
941
- * const t = textmode.create({
942
- * width: window.innerWidth,
943
- * height: window.innerHeight,
944
- * plugins: [FiltersPlugin],
945
- * });
946
- *
947
- * let video;
948
- *
949
- * t.setup(async () => {
950
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
951
- * video.play();
952
- * video.loop();
953
- * video.characters(' .:-=+*#%@');
954
- * });
955
- *
956
- * t.draw(() => {
957
- * t.background(0);
958
- * if (video) {
959
- * t.image(video, t.grid.cols, t.grid.rows);
960
- * }
961
- *
962
- * const wobble = Math.sin(t.secs * 2);
963
- * t.layers.base.filter('filmGrain', {
964
- * intensity: 0.2 + wobble * 0.1,
965
- * size: 2 + wobble * 0.5,
966
- * speed: 1 + wobble * 0.2,
967
- * time: t.secs,
968
- * });
969
- * });
970
- *
971
- * t.windowResized(() => {
972
- * t.resizeCanvas(window.innerWidth, window.innerHeight);
973
- * });
974
- * ```
499
+ * {@includeCode ../examples/filmGrain/sketch.js}
975
500
  *
976
501
  * @category Stylization filters
977
502
  */
@@ -1015,3 +540,4 @@ export interface FilmGrainOptions {
1015
540
  */
1016
541
  time: number;
1017
542
  }
543
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;;;;;OASG;IACH,MAAM,EAAE,MAAM,CAAC;CACf;AAMD;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;;;;;;OASG;IACH,MAAM,EAAE,MAAM,CAAC;CACf;AAMD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;;;;OAQG;IACH,MAAM,EAAE,MAAM,CAAC;CACf;AAMD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;;;;;OAUG;IACH,KAAK,EAAE,MAAM,CAAC;CACd;AAMD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,MAAM,CAAC;CACf;AAMD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;OAUG;IACH,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B;AAMD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;;;;;OAQG;IACH,SAAS,EAAE,MAAM,CAAC;CAClB;AAMD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;;;;;;OAQG;IACH,kBAAkB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