textmode.filters.js 1.2.0 → 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.
- package/dist/types/index.d.ts +2 -31
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +15 -505
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +21 -23
package/dist/types/index.d.ts
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
*
|
|
31
31
|
* @module textmode.filters.js
|
|
32
32
|
*/
|
|
33
|
-
import type { TextmodePlugin } from 'textmode.js
|
|
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
|
-
*
|
|
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
|
/**
|
|
@@ -1 +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,
|
|
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"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -6,40 +6,7 @@
|
|
|
6
6
|
* - An options object with named parameters
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
*
|
|
10
|
-
* const t = textmode.create({
|
|
11
|
-
* width: window.innerWidth,
|
|
12
|
-
* height: window.innerHeight,
|
|
13
|
-
* plugins: [FiltersPlugin],
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* let video;
|
|
17
|
-
*
|
|
18
|
-
* t.setup(async () => {
|
|
19
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
20
|
-
* video.play();
|
|
21
|
-
* video.loop();
|
|
22
|
-
* video.characters(' .:-=+*#%@');
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* t.draw(() => {
|
|
26
|
-
* t.background(0);
|
|
27
|
-
* if (video) {
|
|
28
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
29
|
-
* }
|
|
30
|
-
*
|
|
31
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
32
|
-
* t.layers.base.filter('bloom', {
|
|
33
|
-
* threshold: 0.5,
|
|
34
|
-
* intensity: 1 + wobble * 0.35,
|
|
35
|
-
* radius: 6 + wobble * 2,
|
|
36
|
-
* });
|
|
37
|
-
* });
|
|
38
|
-
*
|
|
39
|
-
* t.windowResized(() => {
|
|
40
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
41
|
-
* });
|
|
42
|
-
* ```
|
|
9
|
+
* {@includeCode ../examples/bloom/sketch.js}
|
|
43
10
|
*
|
|
44
11
|
* @module
|
|
45
12
|
*/
|
|
@@ -49,38 +16,7 @@
|
|
|
49
16
|
* Adjusts image brightness by multiplying pixel values.
|
|
50
17
|
*
|
|
51
18
|
* @example
|
|
52
|
-
*
|
|
53
|
-
* const t = textmode.create({
|
|
54
|
-
* width: window.innerWidth,
|
|
55
|
-
* height: window.innerHeight,
|
|
56
|
-
* plugins: [FiltersPlugin],
|
|
57
|
-
* });
|
|
58
|
-
*
|
|
59
|
-
* let video;
|
|
60
|
-
*
|
|
61
|
-
* t.setup(async () => {
|
|
62
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
63
|
-
* video.play();
|
|
64
|
-
* video.loop();
|
|
65
|
-
* video.characters(' .:-=+*#%@');
|
|
66
|
-
* });
|
|
67
|
-
*
|
|
68
|
-
* t.draw(() => {
|
|
69
|
-
* t.background(0);
|
|
70
|
-
* if (video) {
|
|
71
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
72
|
-
* }
|
|
73
|
-
*
|
|
74
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
75
|
-
* t.layers.base.filter('brightness', {
|
|
76
|
-
* amount: 1 + wobble * 0.25,
|
|
77
|
-
* });
|
|
78
|
-
* });
|
|
79
|
-
*
|
|
80
|
-
* t.windowResized(() => {
|
|
81
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
82
|
-
* });
|
|
83
|
-
* ```
|
|
19
|
+
* {@includeCode ../examples/brightness/sketch.js}
|
|
84
20
|
*
|
|
85
21
|
* @category Color adjustment filters
|
|
86
22
|
*/
|
|
@@ -103,38 +39,7 @@ export interface BrightnessOptions {
|
|
|
103
39
|
* Adjusts image contrast by scaling pixel values around mid-gray.
|
|
104
40
|
*
|
|
105
41
|
* @example
|
|
106
|
-
*
|
|
107
|
-
* const t = textmode.create({
|
|
108
|
-
* width: window.innerWidth,
|
|
109
|
-
* height: window.innerHeight,
|
|
110
|
-
* plugins: [FiltersPlugin],
|
|
111
|
-
* });
|
|
112
|
-
*
|
|
113
|
-
* let video;
|
|
114
|
-
*
|
|
115
|
-
* t.setup(async () => {
|
|
116
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
117
|
-
* video.play();
|
|
118
|
-
* video.loop();
|
|
119
|
-
* video.characters(' .:-=+*#%@');
|
|
120
|
-
* });
|
|
121
|
-
*
|
|
122
|
-
* t.draw(() => {
|
|
123
|
-
* t.background(0);
|
|
124
|
-
* if (video) {
|
|
125
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
126
|
-
* }
|
|
127
|
-
*
|
|
128
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
129
|
-
* t.layers.base.filter('contrast', {
|
|
130
|
-
* amount: 1 + wobble * 0.35,
|
|
131
|
-
* });
|
|
132
|
-
* });
|
|
133
|
-
*
|
|
134
|
-
* t.windowResized(() => {
|
|
135
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
136
|
-
* });
|
|
137
|
-
* ```
|
|
42
|
+
* {@includeCode ../examples/contrast/sketch.js}
|
|
138
43
|
*
|
|
139
44
|
* @category Color adjustment filters
|
|
140
45
|
*/
|
|
@@ -158,38 +63,7 @@ export interface ContrastOptions {
|
|
|
158
63
|
* Perfect for creating vivid, oversaturated looks or desaturating to grayscale.
|
|
159
64
|
*
|
|
160
65
|
* @example
|
|
161
|
-
*
|
|
162
|
-
* const t = textmode.create({
|
|
163
|
-
* width: window.innerWidth,
|
|
164
|
-
* height: window.innerHeight,
|
|
165
|
-
* plugins: [FiltersPlugin],
|
|
166
|
-
* });
|
|
167
|
-
*
|
|
168
|
-
* let video;
|
|
169
|
-
*
|
|
170
|
-
* t.setup(async () => {
|
|
171
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
172
|
-
* video.play();
|
|
173
|
-
* video.loop();
|
|
174
|
-
* video.characters(' .:-=+*#%@');
|
|
175
|
-
* });
|
|
176
|
-
*
|
|
177
|
-
* t.draw(() => {
|
|
178
|
-
* t.background(0);
|
|
179
|
-
* if (video) {
|
|
180
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
181
|
-
* }
|
|
182
|
-
*
|
|
183
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
184
|
-
* t.layers.base.filter('saturation', {
|
|
185
|
-
* amount: 1 + wobble * 0.45,
|
|
186
|
-
* });
|
|
187
|
-
* });
|
|
188
|
-
*
|
|
189
|
-
* t.windowResized(() => {
|
|
190
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
191
|
-
* });
|
|
192
|
-
* ```
|
|
66
|
+
* {@includeCode ../examples/saturation/sketch.js}
|
|
193
67
|
*
|
|
194
68
|
* @category Color adjustment filters
|
|
195
69
|
*/
|
|
@@ -212,39 +86,7 @@ export interface SaturationOptions {
|
|
|
212
86
|
* Useful for color grading or creating surreal color effects.
|
|
213
87
|
*
|
|
214
88
|
* @example
|
|
215
|
-
*
|
|
216
|
-
* const t = textmode.create({
|
|
217
|
-
* width: window.innerWidth,
|
|
218
|
-
* height: window.innerHeight,
|
|
219
|
-
* plugins: [FiltersPlugin],
|
|
220
|
-
* });
|
|
221
|
-
*
|
|
222
|
-
* let video;
|
|
223
|
-
*
|
|
224
|
-
* t.setup(async () => {
|
|
225
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
226
|
-
* video.play();
|
|
227
|
-
* video.loop();
|
|
228
|
-
* video.characters(' .:-=+*#%@');
|
|
229
|
-
* });
|
|
230
|
-
*
|
|
231
|
-
* t.draw(() => {
|
|
232
|
-
* t.background(0);
|
|
233
|
-
* if (video) {
|
|
234
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
235
|
-
* }
|
|
236
|
-
*
|
|
237
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
238
|
-
* const hue = (t.frameCount * 2 + wobble * 45) % 360;
|
|
239
|
-
* t.layers.base.filter('hueRotate', {
|
|
240
|
-
* angle: hue,
|
|
241
|
-
* });
|
|
242
|
-
* });
|
|
243
|
-
*
|
|
244
|
-
* t.windowResized(() => {
|
|
245
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
246
|
-
* });
|
|
247
|
-
* ```
|
|
89
|
+
* {@includeCode ../examples/hueRotate/sketch.js}
|
|
248
90
|
*
|
|
249
91
|
* @category Color adjustment filters
|
|
250
92
|
*/
|
|
@@ -269,38 +111,7 @@ export interface HueRotateOptions {
|
|
|
269
111
|
* creating a retro quantized/poster-like look.
|
|
270
112
|
*
|
|
271
113
|
* @example
|
|
272
|
-
*
|
|
273
|
-
* const t = textmode.create({
|
|
274
|
-
* width: window.innerWidth,
|
|
275
|
-
* height: window.innerHeight,
|
|
276
|
-
* plugins: [FiltersPlugin],
|
|
277
|
-
* });
|
|
278
|
-
*
|
|
279
|
-
* let video;
|
|
280
|
-
*
|
|
281
|
-
* t.setup(async () => {
|
|
282
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
283
|
-
* video.play();
|
|
284
|
-
* video.loop();
|
|
285
|
-
* video.characters(' .:-=+*#%@');
|
|
286
|
-
* });
|
|
287
|
-
*
|
|
288
|
-
* t.draw(() => {
|
|
289
|
-
* t.background(0);
|
|
290
|
-
* if (video) {
|
|
291
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
292
|
-
* }
|
|
293
|
-
*
|
|
294
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
295
|
-
* t.layers.base.filter('posterize', {
|
|
296
|
-
* levels: Math.max(2, Math.round(5 + wobble * 3)),
|
|
297
|
-
* });
|
|
298
|
-
* });
|
|
299
|
-
*
|
|
300
|
-
* t.windowResized(() => {
|
|
301
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
302
|
-
* });
|
|
303
|
-
* ```
|
|
114
|
+
* {@includeCode ../examples/posterize/sketch.js}
|
|
304
115
|
*
|
|
305
116
|
* @category Color adjustment filters
|
|
306
117
|
*/
|
|
@@ -326,39 +137,7 @@ export interface PosterizeOptions {
|
|
|
326
137
|
* found in cheap cameras or creates stylized glitch aesthetics.
|
|
327
138
|
*
|
|
328
139
|
* @example
|
|
329
|
-
*
|
|
330
|
-
* const t = textmode.create({
|
|
331
|
-
* width: window.innerWidth,
|
|
332
|
-
* height: window.innerHeight,
|
|
333
|
-
* plugins: [FiltersPlugin],
|
|
334
|
-
* });
|
|
335
|
-
*
|
|
336
|
-
* let video;
|
|
337
|
-
*
|
|
338
|
-
* t.setup(async () => {
|
|
339
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
340
|
-
* video.play();
|
|
341
|
-
* video.loop();
|
|
342
|
-
* video.characters(' .:-=+*#%@');
|
|
343
|
-
* });
|
|
344
|
-
*
|
|
345
|
-
* t.draw(() => {
|
|
346
|
-
* t.background(0);
|
|
347
|
-
* if (video) {
|
|
348
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
349
|
-
* }
|
|
350
|
-
*
|
|
351
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
352
|
-
* t.layers.base.filter('chromaticAberration', {
|
|
353
|
-
* amount: 6 + wobble * 4,
|
|
354
|
-
* direction: [Math.sin(t.secs), Math.cos(t.secs)],
|
|
355
|
-
* });
|
|
356
|
-
* });
|
|
357
|
-
*
|
|
358
|
-
* t.windowResized(() => {
|
|
359
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
360
|
-
* });
|
|
361
|
-
* ```
|
|
140
|
+
* {@includeCode ../examples/chromaticAberration/sketch.js}
|
|
362
141
|
*
|
|
363
142
|
* @category Distortion filters
|
|
364
143
|
*/
|
|
@@ -391,38 +170,7 @@ export interface ChromaticAberrationOptions {
|
|
|
391
170
|
* reminiscent of retro video games or censored content.
|
|
392
171
|
*
|
|
393
172
|
* @example
|
|
394
|
-
*
|
|
395
|
-
* const t = textmode.create({
|
|
396
|
-
* width: window.innerWidth,
|
|
397
|
-
* height: window.innerHeight,
|
|
398
|
-
* plugins: [FiltersPlugin],
|
|
399
|
-
* });
|
|
400
|
-
*
|
|
401
|
-
* let video;
|
|
402
|
-
*
|
|
403
|
-
* t.setup(async () => {
|
|
404
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
405
|
-
* video.play();
|
|
406
|
-
* video.loop();
|
|
407
|
-
* video.characters(' .:-=+*#%@');
|
|
408
|
-
* });
|
|
409
|
-
*
|
|
410
|
-
* t.draw(() => {
|
|
411
|
-
* t.background(0);
|
|
412
|
-
* if (video) {
|
|
413
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
414
|
-
* }
|
|
415
|
-
*
|
|
416
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
417
|
-
* t.layers.base.filter('pixelate', {
|
|
418
|
-
* pixelSize: 6 + wobble * 3,
|
|
419
|
-
* });
|
|
420
|
-
* });
|
|
421
|
-
*
|
|
422
|
-
* t.windowResized(() => {
|
|
423
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
424
|
-
* });
|
|
425
|
-
* ```
|
|
173
|
+
* {@includeCode ../examples/pixelate/sketch.js}
|
|
426
174
|
*
|
|
427
175
|
* @category Distortion filters
|
|
428
176
|
*/
|
|
@@ -449,46 +197,7 @@ export interface PixelateOptions {
|
|
|
449
197
|
* you to create dynamic text distortion effects.
|
|
450
198
|
*
|
|
451
199
|
* @example
|
|
452
|
-
*
|
|
453
|
-
* const t = textmode.create({
|
|
454
|
-
* width: window.innerWidth,
|
|
455
|
-
* height: window.innerHeight,
|
|
456
|
-
* plugins: [FiltersPlugin],
|
|
457
|
-
* });
|
|
458
|
-
*
|
|
459
|
-
* let video;
|
|
460
|
-
*
|
|
461
|
-
* t.setup(async () => {
|
|
462
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
463
|
-
* video.play();
|
|
464
|
-
* video.loop();
|
|
465
|
-
* video.characters(' .:-=+*#%@');
|
|
466
|
-
* });
|
|
467
|
-
*
|
|
468
|
-
* t.draw(() => {
|
|
469
|
-
* t.background(0);
|
|
470
|
-
* if (video) {
|
|
471
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
472
|
-
* }
|
|
473
|
-
*
|
|
474
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
475
|
-
* const widthFactors = Array.from({ length: t.grid.cols }, (_, i) => (Math.sin(i * 0.18 + t.frameCount * 0.04) + 1) * 0.5);
|
|
476
|
-
* const heightFactors = Array.from({ length: t.grid.rows }, (_, i) => (Math.sin(i * 0.24 + t.secs * 1.5) + 1) * 0.5);
|
|
477
|
-
* t.layers.base.filter('gridDistortion', {
|
|
478
|
-
* gridCellDimensions: [t.grid.cols, t.grid.rows],
|
|
479
|
-
* gridPixelDimensions: [t.grid.width, t.grid.height],
|
|
480
|
-
* gridOffsetDimensions: [t.grid.offsetX, t.grid.offsetY],
|
|
481
|
-
* widthFactors,
|
|
482
|
-
* heightFactors,
|
|
483
|
-
* widthVariationScale: 0.35 + wobble * 0.15,
|
|
484
|
-
* heightVariationScale: 0.35 + wobble * 0.15,
|
|
485
|
-
* });
|
|
486
|
-
* });
|
|
487
|
-
*
|
|
488
|
-
* t.windowResized(() => {
|
|
489
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
490
|
-
* });
|
|
491
|
-
* ```
|
|
200
|
+
* {@includeCode ../examples/gridDistortion/sketch.js}
|
|
492
201
|
*
|
|
493
202
|
* @category Distortion filters
|
|
494
203
|
*/
|
|
@@ -568,38 +277,7 @@ export interface GridDistortionOptions {
|
|
|
568
277
|
* Creates a corrupted/broken digital signal aesthetic.
|
|
569
278
|
*
|
|
570
279
|
* @example
|
|
571
|
-
*
|
|
572
|
-
* const t = textmode.create({
|
|
573
|
-
* width: window.innerWidth,
|
|
574
|
-
* height: window.innerHeight,
|
|
575
|
-
* plugins: [FiltersPlugin],
|
|
576
|
-
* });
|
|
577
|
-
*
|
|
578
|
-
* let video;
|
|
579
|
-
*
|
|
580
|
-
* t.setup(async () => {
|
|
581
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
582
|
-
* video.play();
|
|
583
|
-
* video.loop();
|
|
584
|
-
* video.characters(' .:-=+*#%@');
|
|
585
|
-
* });
|
|
586
|
-
*
|
|
587
|
-
* t.draw(() => {
|
|
588
|
-
* t.background(0);
|
|
589
|
-
* if (video) {
|
|
590
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
591
|
-
* }
|
|
592
|
-
*
|
|
593
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
594
|
-
* t.layers.base.filter('glitch', {
|
|
595
|
-
* amount: Math.max(0, 0.2 + wobble * 0.8),
|
|
596
|
-
* });
|
|
597
|
-
* });
|
|
598
|
-
*
|
|
599
|
-
* t.windowResized(() => {
|
|
600
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
601
|
-
* });
|
|
602
|
-
* ```
|
|
280
|
+
* {@includeCode ../examples/glitch/sketch.js}
|
|
603
281
|
*
|
|
604
282
|
* @category Stylization filters
|
|
605
283
|
*/
|
|
@@ -623,40 +301,7 @@ export interface GlitchOptions {
|
|
|
623
301
|
* classic CRT shader.
|
|
624
302
|
*
|
|
625
303
|
* @example
|
|
626
|
-
*
|
|
627
|
-
* const t = textmode.create({
|
|
628
|
-
* width: window.innerWidth,
|
|
629
|
-
* height: window.innerHeight,
|
|
630
|
-
* plugins: [FiltersPlugin],
|
|
631
|
-
* });
|
|
632
|
-
*
|
|
633
|
-
* let video;
|
|
634
|
-
*
|
|
635
|
-
* t.setup(async () => {
|
|
636
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
637
|
-
* video.play();
|
|
638
|
-
* video.loop();
|
|
639
|
-
* video.characters(' .:-=+*#%@');
|
|
640
|
-
* });
|
|
641
|
-
*
|
|
642
|
-
* t.draw(() => {
|
|
643
|
-
* t.background(0);
|
|
644
|
-
* if (video) {
|
|
645
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
646
|
-
* }
|
|
647
|
-
*
|
|
648
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
649
|
-
* t.layers.base.filter('crtMattias', {
|
|
650
|
-
* curvature: 0.45 + wobble * 0.1,
|
|
651
|
-
* scanSpeed: 1 + wobble * 0.25,
|
|
652
|
-
* time: t.secs,
|
|
653
|
-
* });
|
|
654
|
-
* });
|
|
655
|
-
*
|
|
656
|
-
* t.windowResized(() => {
|
|
657
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
658
|
-
* });
|
|
659
|
-
* ```
|
|
304
|
+
* {@includeCode ../examples/crtMattias/sketch.js}
|
|
660
305
|
*
|
|
661
306
|
* @see {@link https://github.com/libretro/glsl-shaders/blob/master/crt/shaders/crt-mattias.glsl | Original shader by Mattias Gustavsson}
|
|
662
307
|
*
|
|
@@ -699,42 +344,7 @@ export interface CrtMattiasOptions {
|
|
|
699
344
|
* the scanlines in crtMattias.
|
|
700
345
|
*
|
|
701
346
|
* @example
|
|
702
|
-
*
|
|
703
|
-
* const t = textmode.create({
|
|
704
|
-
* width: window.innerWidth,
|
|
705
|
-
* height: window.innerHeight,
|
|
706
|
-
* plugins: [FiltersPlugin],
|
|
707
|
-
* });
|
|
708
|
-
*
|
|
709
|
-
* let video;
|
|
710
|
-
*
|
|
711
|
-
* t.setup(async () => {
|
|
712
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
713
|
-
* video.play();
|
|
714
|
-
* video.loop();
|
|
715
|
-
* video.characters(' .:-=+*#%@');
|
|
716
|
-
* });
|
|
717
|
-
*
|
|
718
|
-
* t.draw(() => {
|
|
719
|
-
* t.background(0);
|
|
720
|
-
* if (video) {
|
|
721
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
722
|
-
* }
|
|
723
|
-
*
|
|
724
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
725
|
-
* t.layers.base.filter('scanlines', {
|
|
726
|
-
* count: 256,
|
|
727
|
-
* lineWidth: 0.5,
|
|
728
|
-
* intensity: 0.7 + wobble * 0.1,
|
|
729
|
-
* speed: 1 + wobble * 0.15,
|
|
730
|
-
* time: t.secs,
|
|
731
|
-
* });
|
|
732
|
-
* });
|
|
733
|
-
*
|
|
734
|
-
* t.windowResized(() => {
|
|
735
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
736
|
-
* });
|
|
737
|
-
* ```
|
|
347
|
+
* {@includeCode ../examples/scanlines/sketch.js}
|
|
738
348
|
*
|
|
739
349
|
* @category Stylization filters
|
|
740
350
|
*/
|
|
@@ -795,40 +405,7 @@ export interface ScanlinesOptions {
|
|
|
795
405
|
* Useful for creating a cinematic look or highlighting central content.
|
|
796
406
|
*
|
|
797
407
|
* @example
|
|
798
|
-
*
|
|
799
|
-
* const t = textmode.create({
|
|
800
|
-
* width: window.innerWidth,
|
|
801
|
-
* height: window.innerHeight,
|
|
802
|
-
* plugins: [FiltersPlugin],
|
|
803
|
-
* });
|
|
804
|
-
*
|
|
805
|
-
* let video;
|
|
806
|
-
*
|
|
807
|
-
* t.setup(async () => {
|
|
808
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
809
|
-
* video.play();
|
|
810
|
-
* video.loop();
|
|
811
|
-
* video.characters(' .:-=+*#%@');
|
|
812
|
-
* });
|
|
813
|
-
*
|
|
814
|
-
* t.draw(() => {
|
|
815
|
-
* t.background(0);
|
|
816
|
-
* if (video) {
|
|
817
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
818
|
-
* }
|
|
819
|
-
*
|
|
820
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
821
|
-
* t.layers.base.filter('vignette', {
|
|
822
|
-
* amount: 0.5 + wobble * 0.2,
|
|
823
|
-
* softness: 0.5,
|
|
824
|
-
* roundness: 0.5 + wobble * 0.15,
|
|
825
|
-
* });
|
|
826
|
-
* });
|
|
827
|
-
*
|
|
828
|
-
* t.windowResized(() => {
|
|
829
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
830
|
-
* });
|
|
831
|
-
* ```
|
|
408
|
+
* {@includeCode ../examples/vignette/sketch.js}
|
|
832
409
|
*
|
|
833
410
|
* @category Stylization filters
|
|
834
411
|
*/
|
|
@@ -872,40 +449,7 @@ export interface VignetteOptions {
|
|
|
872
449
|
* Perfect for creating neon, glowing text, or dreamy effects.
|
|
873
450
|
*
|
|
874
451
|
* @example
|
|
875
|
-
*
|
|
876
|
-
* const t = textmode.create({
|
|
877
|
-
* width: window.innerWidth,
|
|
878
|
-
* height: window.innerHeight,
|
|
879
|
-
* plugins: [FiltersPlugin],
|
|
880
|
-
* });
|
|
881
|
-
*
|
|
882
|
-
* let video;
|
|
883
|
-
*
|
|
884
|
-
* t.setup(async () => {
|
|
885
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
886
|
-
* video.play();
|
|
887
|
-
* video.loop();
|
|
888
|
-
* video.characters(' .:-=+*#%@');
|
|
889
|
-
* });
|
|
890
|
-
*
|
|
891
|
-
* t.draw(() => {
|
|
892
|
-
* t.background(0);
|
|
893
|
-
* if (video) {
|
|
894
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
895
|
-
* }
|
|
896
|
-
*
|
|
897
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
898
|
-
* t.layers.base.filter('bloom', {
|
|
899
|
-
* threshold: 0.5,
|
|
900
|
-
* intensity: 1.2 + wobble * 0.5,
|
|
901
|
-
* radius: 6 + wobble * 2,
|
|
902
|
-
* });
|
|
903
|
-
* });
|
|
904
|
-
*
|
|
905
|
-
* t.windowResized(() => {
|
|
906
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
907
|
-
* });
|
|
908
|
-
* ```
|
|
452
|
+
* {@includeCode ../examples/bloom/sketch.js}
|
|
909
453
|
*
|
|
910
454
|
* @category Stylization filters
|
|
911
455
|
*/
|
|
@@ -952,41 +496,7 @@ export interface BloomOptions {
|
|
|
952
496
|
* real film characteristics.
|
|
953
497
|
*
|
|
954
498
|
* @example
|
|
955
|
-
*
|
|
956
|
-
* const t = textmode.create({
|
|
957
|
-
* width: window.innerWidth,
|
|
958
|
-
* height: window.innerHeight,
|
|
959
|
-
* plugins: [FiltersPlugin],
|
|
960
|
-
* });
|
|
961
|
-
*
|
|
962
|
-
* let video;
|
|
963
|
-
*
|
|
964
|
-
* t.setup(async () => {
|
|
965
|
-
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
966
|
-
* video.play();
|
|
967
|
-
* video.loop();
|
|
968
|
-
* video.characters(' .:-=+*#%@');
|
|
969
|
-
* });
|
|
970
|
-
*
|
|
971
|
-
* t.draw(() => {
|
|
972
|
-
* t.background(0);
|
|
973
|
-
* if (video) {
|
|
974
|
-
* t.image(video, t.grid.cols, t.grid.rows);
|
|
975
|
-
* }
|
|
976
|
-
*
|
|
977
|
-
* const wobble = Math.sin(t.secs * 2);
|
|
978
|
-
* t.layers.base.filter('filmGrain', {
|
|
979
|
-
* intensity: 0.2 + wobble * 0.1,
|
|
980
|
-
* size: 2 + wobble * 0.5,
|
|
981
|
-
* speed: 1 + wobble * 0.2,
|
|
982
|
-
* time: t.secs,
|
|
983
|
-
* });
|
|
984
|
-
* });
|
|
985
|
-
*
|
|
986
|
-
* t.windowResized(() => {
|
|
987
|
-
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
988
|
-
* });
|
|
989
|
-
* ```
|
|
499
|
+
* {@includeCode ../examples/filmGrain/sketch.js}
|
|
990
500
|
*
|
|
991
501
|
* @category Stylization filters
|
|
992
502
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;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ACH,IAAI,EAAE,MAAM,CAAC;CACb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textmode.filters.js",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Image filters plugin for textmode.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/textmode.filters.umd.js",
|
|
@@ -18,14 +18,17 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"dev": "vite --port 5179 --host",
|
|
21
|
-
"build": "vite build
|
|
22
|
-
"
|
|
21
|
+
"build:bundle": "vite build",
|
|
22
|
+
"build:types": "tsc",
|
|
23
|
+
"build": "npm run build:bundle && npm run build:types",
|
|
24
|
+
"check": "npm run check:format && npm run lint && npm run lint:md && npm run check:types && npm run check:examples && npm run build",
|
|
25
|
+
"check:examples": "node ./scripts/check-examples.mjs",
|
|
23
26
|
"dev:docs": "typedoc --watch",
|
|
24
27
|
"build:docs": "typedoc",
|
|
25
28
|
"preview": "vite preview",
|
|
26
|
-
"format": "prettier --write
|
|
27
|
-
"format
|
|
28
|
-
"
|
|
29
|
+
"format": "prettier --write .",
|
|
30
|
+
"check:format": "prettier --check .",
|
|
31
|
+
"check:types": "tsc --noEmit",
|
|
29
32
|
"lint:md": "markdownlint-cli2",
|
|
30
33
|
"lint:md:fix": "markdownlint-cli2 --fix",
|
|
31
34
|
"lint": "eslint src --config eslint.config.js",
|
|
@@ -35,41 +38,36 @@
|
|
|
35
38
|
"textmode.js": ">=0.7.0"
|
|
36
39
|
},
|
|
37
40
|
"devDependencies": {
|
|
38
|
-
"@commitlint/cli": "^20.
|
|
39
|
-
"@commitlint/config-conventional": "^20.
|
|
41
|
+
"@commitlint/cli": "^20.5.0",
|
|
42
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
40
43
|
"@eslint/js": "^9.39.4",
|
|
41
44
|
"@mapwhit/glsl-minify": "^1.0.0",
|
|
42
45
|
"@rollup/plugin-terser": "^0.4.4",
|
|
43
|
-
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
44
46
|
"@semantic-release/exec": "^7.1.0",
|
|
45
|
-
"@semantic-release/
|
|
46
|
-
"@semantic-release/npm": "^13.1.5",
|
|
47
|
-
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
47
|
+
"@semantic-release/git": "^10.0.1",
|
|
48
48
|
"@types/node": "^24.0.13",
|
|
49
49
|
"eslint": "^9.39.2",
|
|
50
|
-
"eslint-plugin-jsdoc": "^62.
|
|
51
|
-
"globals": "^17.
|
|
50
|
+
"eslint-plugin-jsdoc": "^62.9.0",
|
|
51
|
+
"globals": "^17.5.0",
|
|
52
52
|
"husky": "^9.1.7",
|
|
53
53
|
"lint-staged": "^16.4.0",
|
|
54
|
-
"markdownlint-cli2": "^0.
|
|
54
|
+
"markdownlint-cli2": "^0.22.1",
|
|
55
55
|
"markdownlint-cli2-formatter-default": "^0.0.6",
|
|
56
|
-
"prettier": "^3.
|
|
56
|
+
"prettier": "^3.8.3",
|
|
57
57
|
"semantic-release": "^25.0.3",
|
|
58
|
-
"textmode.js": "^0.
|
|
59
|
-
"
|
|
60
|
-
"typedoc": "^0.28.13",
|
|
58
|
+
"textmode.js": "^0.16.0",
|
|
59
|
+
"typedoc": "^0.28.19",
|
|
61
60
|
"typedoc-plugin-frontmatter": "^1.3.1",
|
|
62
|
-
"typedoc-plugin-markdown": "^4.
|
|
61
|
+
"typedoc-plugin-markdown": "^4.11.0",
|
|
63
62
|
"typedoc-vitepress-theme": "^1.1.2",
|
|
64
63
|
"typescript": "^5.9.2",
|
|
65
|
-
"typescript-eslint": "^8.
|
|
64
|
+
"typescript-eslint": "^8.59.0",
|
|
66
65
|
"vite": "^6.3.4"
|
|
67
66
|
},
|
|
68
67
|
"license": "MIT",
|
|
69
68
|
"author": "humanbydefinition",
|
|
70
69
|
"lint-staged": {
|
|
71
|
-
"
|
|
72
|
-
".*.{js,json,jsonc}": "prettier --write"
|
|
70
|
+
"*": "prettier --ignore-unknown --write"
|
|
73
71
|
},
|
|
74
72
|
"repository": {
|
|
75
73
|
"type": "git",
|