textmode.filters.js 1.1.1 → 1.2.0

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 humanbydefinition
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2025 humanbydefinition
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,386 +1,403 @@
1
- # textmode.filters.js
2
-
3
- <div align="center">
4
-
5
- <!-- Add your banner image here when ready -->
6
- <!-- <img alt="textmode_filters_banner" src="YOUR_BANNER_IMAGE_URL" /> -->
7
-
8
- | [![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) [![WebGL](https://img.shields.io/badge/WebGL2-990000?logo=webgl&logoColor=white)](https://www.khronos.org/webgl/) [![Vite](https://img.shields.io/badge/Vite-646CFF?logo=vite&logoColor=white)](https://vitejs.dev/) | [![npm version](https://img.shields.io/npm/v/textmode.filters.js.svg)](https://www.npmjs.com/package/textmode.filters.js) [![license](https://img.shields.io/npm/l/textmode.filters.js.svg)](https://github.com/humanbydefinition/textmode.filters.js/blob/main/LICENSE) | [![Discord](https://img.shields.io/discord/1357070706181017691?color=5865F2&label=Discord&logo=discord&logoColor=white)](https://discord.gg/sjrw8QXNks) [![ko-fi](https://shields.io/badge/ko--fi-donate-ff5f5f?logo=ko-fi)](https://ko-fi.com/V7V8JG2FY) [![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/humanbydefinition) |
9
- |:-------------|:-------------|:-------------|
10
-
11
- </div>
12
-
13
- textmode.filters.js is a GPU-accelerated image filters plugin for [textmode.js](https://code.textmode.art/). Built with [`WebGL2`](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext) fragment shaders, it provides a collection of customizable visual effects that run entirely on the GPU for maximum performance.
14
-
15
- [Installation](#installation) •
16
- [Usage](#usage) •
17
- [Filters](#filters) •
18
- [Contributing](#contributing)
19
-
20
- ## Features
21
-
22
- - 🚀 **GPU-accelerated** - All filters run on the GPU via WebGL2 fragment shaders
23
- - 🎛️ **Customizable parameters** - Fine-tune each filter to your needs
24
- - 📦 **Lightweight** - Minimal footprint, no external dependencies
25
- - 🤝 **Open to contributions** - Easy to add your own custom filters!
26
-
27
- ## Installation
28
-
29
- ```bash
30
- npm install textmode.filters.js
31
- ```
32
-
33
- You can also use it via CDN:
34
-
35
- ```html
36
- <!-- ESM -->
37
- <script type="module" src="https://unpkg.com/textmode.js/dist/textmode.esm.js"></script>
38
- <script type="module" src="https://unpkg.com/textmode.filters.js/dist/textmode.filters.esm.js"></script>
39
-
40
- <!-- UMD -->
41
- <script src="https://unpkg.com/textmode.js/dist/textmode.umd.js"></script>
42
- <script src="https://unpkg.com/textmode.filters.js/dist/textmode.filters.umd.js"></script>
43
- ```
44
-
45
- ## Usage
46
-
47
- ### ESM
48
-
49
- ```javascript
50
- import { textmode } from 'textmode.js';
51
- import { FiltersPlugin } from 'textmode.filters.js';
52
-
53
- const t = textmode.create({
54
- width: 800,
55
- height: 600,
56
- plugins: [FiltersPlugin],
57
- });
58
-
59
- t.draw(() => {
60
- // Apply filters to layers
61
- t.layers.base.filter('brightness', 1.2);
62
- t.layers.base.filter('contrast', { amount: 1.5 });
63
-
64
- t.background(0);
65
- // ... draw something ...
66
- });
67
- ```
68
-
69
- ### UMD
70
-
71
- ```html
72
- <script src="https://unpkg.com/textmode.js/dist/textmode.umd.js"></script>
73
- <script src="https://unpkg.com/textmode.filters.js/dist/textmode.filters.umd.js"></script>
74
- <script>
75
- const t = textmode.create({
76
- plugins: [FiltersPlugin],
77
- });
78
-
79
- t.draw(() => {
80
- t.layers.base.filter('brightness', 1.3);
81
- });
82
- </script>
83
- ```
84
-
85
- ## Filters
86
-
87
- ### `brightness`
88
-
89
- Adjust image brightness *(1.0 = normal, >1 = brighter, <1 = darker)*
90
-
91
- **Parameters:**
92
- - `amount` - Brightness multiplier
93
- Default: `1.0` | Range: `0.0` - `∞`
94
-
95
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
96
-
97
- ---
98
-
99
- ### `contrast`
100
-
101
- Adjust image contrast *(1.0 = normal, >1 = more contrast, <1 = less)*
102
-
103
- **Parameters:**
104
- - `amount` - Contrast multiplier
105
- Default: `1.0` | Range: `0.0` - `∞`
106
-
107
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
108
-
109
- ---
110
-
111
- ### `hueRotate`
112
-
113
- Shift colors around the color wheel
114
-
115
- **Parameters:**
116
- - `angle` - Rotation angle in degrees
117
- Default: `0.0` | Range: `0.0` - `360.0`
118
-
119
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
120
-
121
- ---
122
-
123
- ### `glitch`
124
-
125
- Digital glitch effect with RGB channel separation, scanlines, and noise
126
-
127
- **Parameters:**
128
- - `amount` - Glitch intensity
129
- Default: `0.0` | Range: `0.0` - `∞`
130
-
131
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
132
-
133
- ---
134
-
135
- ### `chromaticAberration`
136
-
137
- RGB color channel separation effect that simulates lens distortion
138
-
139
- **Parameters:**
140
- - `amount` - Offset amount in pixels
141
- Default: `5.0` | Range: `0.0` - `∞`
142
- - `direction` - Direction of the color separation as `[x, y]`
143
- Default: `[1.0, 0.0]` (horizontal)
144
-
145
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
146
-
147
- ---
148
-
149
- ### `pixelate`
150
-
151
- Reduce image resolution to create a mosaic/pixelated effect
152
-
153
- **Parameters:**
154
- - `pixelSize` - Size of each pixel block in pixels
155
- Default: `4.0` | Range: `1.0` - `∞`
156
-
157
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
158
-
159
- ---
160
-
161
- ### `gridDistortion`
162
-
163
- Distort a monospaced character grid by varying the width and height of individual cells. Create wave effects, perspective distortions, or other grid warping effects by providing custom factor arrays.
164
-
165
- **Parameters:**
166
- - `gridSize` - Grid dimensions as `[columns, rows]`
167
- Default: `[80, 40]` | Maximum: `[128, 128]`
168
- - `widthFactors` - Array of distortion values (0-1) for each column
169
- Must contain at least as many elements as columns (max 128)
170
- - `heightFactors` - Array of distortion values (0-1) for each row
171
- Must contain at least as many elements as rows (max 128)
172
- - `widthVariationScale` - Intensity multiplier for width distortion
173
- Default: `0.5` | Range: `0.0` - `∞`
174
- - `heightVariationScale` - Intensity multiplier for height distortion
175
- Default: `0.5` | Range: `0.0` - `∞`
176
-
177
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
178
-
179
- ---
180
-
181
- ### `crtMattias`
182
-
183
- CRT monitor emulation effect with screen curvature, animated scanlines, blur, vignette, and film grain noise.
184
-
185
- **Parameters:**
186
- - `curvature` - Amount of screen curvature/barrel distortion
187
- Default: `0.5` | Range: `0.0` - `1.0`
188
- - `scanSpeed` - Speed of the scrolling scanline effect
189
- Default: `1.0` | Range: `0.0` - `10.0`
190
- - `time` - Animation time
191
- Default: `0.0`
192
-
193
- **Author:** [@mattiasgustavsson](https://github.com/mattiasgustavsson)
194
- **Source:** https://github.com/libretro/glsl-shaders/blob/master/crt/shaders/crt-mattias.glsl
195
-
196
- ---
197
- ### `scanlines`
198
-
199
- A standalone scanline effect that adds horizontal lines to the image to simulate a CRT display or old monitor. Adjustable density, thickness, and movement speed.
200
-
201
- **Parameters:**
202
- - `count` - Number of scanlines
203
- Default: `300.0` | Range: `10.0` - `∞`
204
- - `lineWidth` - Width of the lines relative to the spacing
205
- Default: `0.5` | Range: `0.0` - `1.0`
206
- - `intensity` - Opacity of the scanlines
207
- Default: `0.75` | Range: `0.0` - `1.0`
208
- - `speed` - Scrolling speed of the lines
209
- Default: `1.0` | Range: `0.0` - `∞`
210
- - `time` - Animation time
211
- Default: `0.0`
212
-
213
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
214
-
215
- ---
216
-
217
- ### `vignette`
218
-
219
- Darkens the edges and corners of the image, drawing focus to the center. Useful for creating a cinematic look or highlighting central content.
220
-
221
- **Parameters:**
222
- - `amount` - Intensity of the darkening effect
223
- Default: `0.5` | Range: `0.0` - `1.0`
224
- - `softness` - Falloff gradient softness (0 = hard edge, 1 = very soft)
225
- Default: `0.5` | Range: `0.0` - `1.0`
226
- - `roundness` - Shape of the vignette (0 = rectangular, 1 = circular)
227
- Default: `0.5` | Range: `0.0` - `1.0`
228
-
229
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
230
-
231
- ---
232
-
233
- ### `bloom`
234
-
235
- Creates a glow effect around bright areas of the image. Pixels above the brightness threshold emit a soft glow that spreads outward, perfect for creating neon, glowing text, or dreamy effects.
236
-
237
- **Parameters:**
238
- - `threshold` - Brightness level above which pixels will glow
239
- Default: `0.5` | Range: `0.0` - `1.0`
240
- - `intensity` - Strength of the glow effect
241
- Default: `1.0` | Range: `0.0` - `∞`
242
- - `radius` - Size of the glow spread in pixels
243
- Default: `4.0` | Range: `1.0` - `∞`
244
-
245
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
246
-
247
- ---
248
-
249
- ### `filmGrain`
250
-
251
- Adds an animated film grain/noise texture overlay to simulate vintage film stock or analog video. The multi-layered noise creates an organic, moving grain pattern that's less visible in darker areas, mimicking real film characteristics.
252
-
253
- **Parameters:**
254
- - `intensity` - Strength of the grain effect
255
- Default: `0.2` | Range: `0.0` - `1.0`
256
- - `size` - Size of grain particles
257
- Default: `2.0` | Range: `1.0` - `10.0`
258
- - `speed` - Animation speed of the grain
259
- Default: `1.0` | Range: `0.0` - `∞`
260
- - `time` - Animation time parameter
261
- Default: `0.0`
262
-
263
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
264
-
265
- ---
266
-
267
- ### `saturation`
268
-
269
- Adjust color intensity without affecting luminance. Perfect for creating vivid, oversaturated looks or desaturating to grayscale.
270
-
271
- **Parameters:**
272
- - `amount` - Saturation multiplier
273
- Default: `1.0` | Range: `0.0` (grayscale) - `∞` (vivid)
274
-
275
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
276
-
277
- ---
278
- ### `posterize`
279
-
280
- Reduces the color palette to a limited number of bands, creating a retro quantized look.
281
-
282
- **Parameters:**
283
- - `levels` - Number of color levels per channel
284
- Default: `4.0` | Range: `1.0` - `∞`
285
-
286
- **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
287
-
288
- ---
289
-
290
- ### Usage examples
291
-
292
- ```javascript
293
- // Using a single value (shorthand)
294
- t.layers.base.filter('brightness', 1.5);
295
- t.layers.base.filter('hueRotate', 180);
296
-
297
- // Using an options object
298
- t.layers.base.filter('contrast', { amount: 0.8 });
299
- t.layers.base.filter('glitch', { amount: 2.0 });
300
-
301
- // Chaining multiple filters in sequence
302
- t.layers.base.filter('brightness', 1.2);
303
- t.layers.base.filter('contrast', 1.3);
304
- t.layers.base.filter('hueRotate', 90);
305
-
306
- // Chromatic aberration with custom direction
307
- t.layers.base.filter('chromaticAberration', { amount: 10, direction: [1, 1] });
308
-
309
- // Pixelate effect
310
- t.layers.base.filter('pixelate', 8);
311
-
312
- // Vignette with custom shape
313
- t.layers.base.filter('vignette', { amount: 0.7, softness: 0.4, roundness: 1.0 });
314
-
315
- // Bloom for glowing bright areas
316
- t.layers.base.filter('bloom', { threshold: 0.6, intensity: 1.5, radius: 8 });
317
-
318
- // Film grain with animation
319
- let time = 0;
320
- t.draw(() => {
321
- t.layers.base.filter('filmGrain', { intensity: 0.3, size: 2, speed: 1.0, time: time });
322
- time += 0.016;
323
- });
324
-
325
- // Saturation adjustments
326
- t.layers.base.filter('saturation', 0); // Grayscale
327
- t.layers.base.filter('saturation', 1.5); // Vivid colors
328
-
329
- // Posterize effect (quantize colors)
330
- t.layers.base.filter('posterize', { levels: 4 });
331
- ```
332
-
333
- ## Adding custom filters
334
-
335
- Want to create your own filter? Check out the [Contributing Guide](CONTRIBUTING.md) for detailed instructions on how to add new filters to this library!
336
-
337
- The basic structure of a filter shader:
338
-
339
- ```glsl
340
- #version 300 es
341
- precision highp float;
342
-
343
- uniform sampler2D u_texture; // Input texture
344
- uniform vec2 u_resolution; // Canvas resolution
345
- uniform float u_yourParam; // Your custom parameter
346
-
347
- in vec2 v_uv;
348
- out vec4 fragColor;
349
-
350
- void main() {
351
- vec4 color = texture(u_texture, v_uv);
352
-
353
- // Your filter logic here
354
- vec3 result = color.rgb; // Modify this!
355
-
356
- fragColor = vec4(result, color.a);
357
- }
358
- ```
359
-
360
- ## Contributing
361
-
362
- Contributions are welcome and greatly appreciated! 🎉
363
-
364
- Whether you want to:
365
- - 🐛 Report a bug
366
- - 💡 Suggest a new filter
367
- - 🔧 Submit a pull request
368
- - 📖 Improve documentation
369
-
370
- Please read our [Contributing Guide](CONTRIBUTING.md) to get started.
371
-
372
- ## Related projects
373
-
374
- - **[textmode.js](https://github.com/humanbydefinition/textmode.js)** - The main textmode.js library
375
- - **[code.textmode.art](https://code.textmode.art/)** - Documentation & examples
376
- - **[editor.textmode.art](https://editor.textmode.art/)** - textmode.js web editor
377
-
378
- ---
379
-
380
- <div align="center">
381
-
382
- <br />
383
-
384
- **[↑ back to top](#-textmodefiltersjs)**
385
-
386
- </div>
1
+ # textmode.filters.js
2
+
3
+ <div align="center">
4
+
5
+ <!-- Add your banner image here when ready -->
6
+ <!-- <img alt="textmode_filters_banner" src="YOUR_BANNER_IMAGE_URL" /> -->
7
+
8
+ | [![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) [![WebGL](https://img.shields.io/badge/WebGL2-990000?logo=webgl&logoColor=white)](https://www.khronos.org/webgl/) [![Vite](https://img.shields.io/badge/Vite-646CFF?logo=vite&logoColor=white)](https://vitejs.dev/) | [![npm version](https://img.shields.io/npm/v/textmode.filters.js.svg)](https://www.npmjs.com/package/textmode.filters.js) [![license](https://img.shields.io/npm/l/textmode.filters.js.svg)](https://github.com/humanbydefinition/textmode.filters.js/blob/main/LICENSE) | [![Discord](https://img.shields.io/discord/1357070706181017691?color=5865F2&label=Discord&logo=discord&logoColor=white)](https://discord.gg/sjrw8QXNks) [![ko-fi](https://shields.io/badge/ko--fi-donate-ff5f5f?logo=ko-fi)](https://ko-fi.com/V7V8JG2FY) [![GitHub-sponsors](https://img.shields.io/badge/sponsor-30363D?logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/humanbydefinition) |
9
+ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10
+
11
+ </div>
12
+
13
+ textmode.filters.js is a GPU-accelerated image filters plugin for [textmode.js](https://code.textmode.art/). Built with [`WebGL2`](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext) fragment shaders, it provides a collection of customizable visual effects that run entirely on the GPU for maximum performance.
14
+
15
+ [Installation](#installation) •
16
+ [Usage](#usage) •
17
+ [Filters](#filters) •
18
+ [Contributing](#contributing)
19
+
20
+ ## Features
21
+
22
+ - 🚀 **GPU-accelerated** - All filters run on the GPU via WebGL2 fragment shaders
23
+ - 🎛️ **Customizable parameters** - Fine-tune each filter to your needs
24
+ - 📦 **Lightweight** - Minimal footprint, no external dependencies
25
+ - 🤝 **Open to contributions** - Easy to add your own custom filters!
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ npm install textmode.filters.js
31
+ ```
32
+
33
+ You can also use it via CDN:
34
+
35
+ ```html
36
+ <!-- ESM -->
37
+ <script type="module" src="https://unpkg.com/textmode.js/dist/textmode.esm.js"></script>
38
+ <script type="module" src="https://unpkg.com/textmode.filters.js/dist/textmode.filters.esm.js"></script>
39
+
40
+ <!-- UMD -->
41
+ <script src="https://unpkg.com/textmode.js/dist/textmode.umd.js"></script>
42
+ <script src="https://unpkg.com/textmode.filters.js/dist/textmode.filters.umd.js"></script>
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ ### ESM
48
+
49
+ ```javascript
50
+ import { textmode } from 'textmode.js';
51
+ import { FiltersPlugin } from 'textmode.filters.js';
52
+
53
+ const t = textmode.create({
54
+ width: 800,
55
+ height: 600,
56
+ plugins: [FiltersPlugin],
57
+ });
58
+
59
+ t.draw(() => {
60
+ // Apply filters to layers
61
+ t.layers.base.filter('brightness', 1.2);
62
+ t.layers.base.filter('contrast', { amount: 1.5 });
63
+
64
+ t.background(0);
65
+ // ... draw something ...
66
+ });
67
+ ```
68
+
69
+ ### UMD
70
+
71
+ ```html
72
+ <script src="https://unpkg.com/textmode.js/dist/textmode.umd.js"></script>
73
+ <script src="https://unpkg.com/textmode.filters.js/dist/textmode.filters.umd.js"></script>
74
+ <script>
75
+ const t = textmode.create({
76
+ plugins: [FiltersPlugin],
77
+ });
78
+
79
+ t.draw(() => {
80
+ t.layers.base.filter('brightness', 1.3);
81
+ });
82
+ </script>
83
+ ```
84
+
85
+ ## Filters
86
+
87
+ ### `brightness`
88
+
89
+ Adjust image brightness *(1.0 = normal, >1 = brighter, <1 = darker)*
90
+
91
+ **Parameters:**
92
+
93
+ - `amount` - Brightness multiplier
94
+ Default: `1.0` | Range: `0.0` - `∞`
95
+
96
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
97
+
98
+ ---
99
+
100
+ ### `contrast`
101
+
102
+ Adjust image contrast *(1.0 = normal, >1 = more contrast, <1 = less)*
103
+
104
+ **Parameters:**
105
+
106
+ - `amount` - Contrast multiplier
107
+ Default: `1.0` | Range: `0.0` - `∞`
108
+
109
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
110
+
111
+ ---
112
+
113
+ ### `hueRotate`
114
+
115
+ Shift colors around the color wheel
116
+
117
+ **Parameters:**
118
+
119
+ - `angle` - Rotation angle in degrees
120
+ Default: `0.0` | Range: `0.0` - `360.0`
121
+
122
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
123
+
124
+ ---
125
+
126
+ ### `glitch`
127
+
128
+ Digital glitch effect with RGB channel separation, scanlines, and noise
129
+
130
+ **Parameters:**
131
+
132
+ - `amount` - Glitch intensity
133
+ Default: `0.0` | Range: `0.0` - `∞`
134
+
135
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
136
+
137
+ ---
138
+
139
+ ### `chromaticAberration`
140
+
141
+ RGB color channel separation effect that simulates lens distortion
142
+
143
+ **Parameters:**
144
+
145
+ - `amount` - Offset amount in pixels
146
+ Default: `5.0` | Range: `0.0` - `∞`
147
+ - `direction` - Direction of the color separation as `[x, y]`
148
+ Default: `[1.0, 0.0]` (horizontal)
149
+
150
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
151
+
152
+ ---
153
+
154
+ ### `pixelate`
155
+
156
+ Reduce image resolution to create a mosaic/pixelated effect
157
+
158
+ **Parameters:**
159
+
160
+ - `pixelSize` - Size of each pixel block in pixels
161
+ Default: `4.0` | Range: `1.0` - `∞`
162
+
163
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
164
+
165
+ ---
166
+
167
+ ### `gridDistortion`
168
+
169
+ Distort a monospaced character grid by varying the width and height of individual cells. Create wave effects, perspective distortions, or other grid warping effects by providing custom factor arrays.
170
+
171
+ **Parameters:**
172
+
173
+ - `gridSize` - Grid dimensions as `[columns, rows]`
174
+ Default: `[80, 40]` | Maximum: `[128, 128]`
175
+ - `widthFactors` - Array of distortion values (0-1) for each column
176
+ Must contain at least as many elements as columns (max 128)
177
+ - `heightFactors` - Array of distortion values (0-1) for each row
178
+ Must contain at least as many elements as rows (max 128)
179
+ - `widthVariationScale` - Intensity multiplier for width distortion
180
+ Default: `0.5` | Range: `0.0` - `∞`
181
+ - `heightVariationScale` - Intensity multiplier for height distortion
182
+ Default: `0.5` | Range: `0.0` - `∞`
183
+
184
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
185
+
186
+ ---
187
+
188
+ ### `crtMattias`
189
+
190
+ CRT monitor emulation effect with screen curvature, animated scanlines, blur, vignette, and film grain noise.
191
+
192
+ **Parameters:**
193
+
194
+ - `curvature` - Amount of screen curvature/barrel distortion
195
+ Default: `0.5` | Range: `0.0` - `1.0`
196
+ - `scanSpeed` - Speed of the scrolling scanline effect
197
+ Default: `1.0` | Range: `0.0` - `10.0`
198
+ - `time` - Animation time
199
+ Default: `0.0`
200
+
201
+ **Author:** [@mattiasgustavsson](https://github.com/mattiasgustavsson)
202
+ **Source:** https://github.com/libretro/glsl-shaders/blob/master/crt/shaders/crt-mattias.glsl
203
+
204
+ ---
205
+
206
+ ### `scanlines`
207
+
208
+ A standalone scanline effect that adds horizontal lines to the image to simulate a CRT display or old monitor. Adjustable density, thickness, and movement speed.
209
+
210
+ **Parameters:**
211
+
212
+ - `count` - Number of scanlines
213
+ Default: `300.0` | Range: `10.0` - `∞`
214
+ - `lineWidth` - Width of the lines relative to the spacing
215
+ Default: `0.5` | Range: `0.0` - `1.0`
216
+ - `intensity` - Opacity of the scanlines
217
+ Default: `0.75` | Range: `0.0` - `1.0`
218
+ - `speed` - Scrolling speed of the lines
219
+ Default: `1.0` | Range: `0.0` - `∞`
220
+ - `time` - Animation time
221
+ Default: `0.0`
222
+
223
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
224
+
225
+ ---
226
+
227
+ ### `vignette`
228
+
229
+ Darkens the edges and corners of the image, drawing focus to the center. Useful for creating a cinematic look or highlighting central content.
230
+
231
+ **Parameters:**
232
+
233
+ - `amount` - Intensity of the darkening effect
234
+ Default: `0.5` | Range: `0.0` - `1.0`
235
+ - `softness` - Falloff gradient softness (0 = hard edge, 1 = very soft)
236
+ Default: `0.5` | Range: `0.0` - `1.0`
237
+ - `roundness` - Shape of the vignette (0 = rectangular, 1 = circular)
238
+ Default: `0.5` | Range: `0.0` - `1.0`
239
+
240
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
241
+
242
+ ---
243
+
244
+ ### `bloom`
245
+
246
+ Creates a glow effect around bright areas of the image. Pixels above the brightness threshold emit a soft glow that spreads outward, perfect for creating neon, glowing text, or dreamy effects.
247
+
248
+ **Parameters:**
249
+
250
+ - `threshold` - Brightness level above which pixels will glow
251
+ Default: `0.5` | Range: `0.0` - `1.0`
252
+ - `intensity` - Strength of the glow effect
253
+ Default: `1.0` | Range: `0.0` - `∞`
254
+ - `radius` - Size of the glow spread in pixels
255
+ Default: `4.0` | Range: `1.0` - `∞`
256
+
257
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
258
+
259
+ ---
260
+
261
+ ### `filmGrain`
262
+
263
+ Adds an animated film grain/noise texture overlay to simulate vintage film stock or analog video. The multi-layered noise creates an organic, moving grain pattern that's less visible in darker areas, mimicking real film characteristics.
264
+
265
+ **Parameters:**
266
+
267
+ - `intensity` - Strength of the grain effect
268
+ Default: `0.2` | Range: `0.0` - `1.0`
269
+ - `size` - Size of grain particles
270
+ Default: `2.0` | Range: `1.0` - `10.0`
271
+ - `speed` - Animation speed of the grain
272
+ Default: `1.0` | Range: `0.0` - `∞`
273
+ - `time` - Animation time parameter
274
+ Default: `0.0`
275
+
276
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
277
+
278
+ ---
279
+
280
+ ### `saturation`
281
+
282
+ Adjust color intensity without affecting luminance. Perfect for creating vivid, oversaturated looks or desaturating to grayscale.
283
+
284
+ **Parameters:**
285
+
286
+ - `amount` - Saturation multiplier
287
+ Default: `1.0` | Range: `0.0` (grayscale) - `∞` (vivid)
288
+
289
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
290
+
291
+ ---
292
+
293
+ ### `posterize`
294
+
295
+ Reduces the color palette to a limited number of bands, creating a retro quantized look.
296
+
297
+ **Parameters:**
298
+
299
+ - `levels` - Number of color levels per channel
300
+ Default: `4.0` | Range: `1.0` - `∞`
301
+
302
+ **Author:** [@humanbydefinition](https://github.com/humanbydefinition)
303
+
304
+ ---
305
+
306
+ ### Usage examples
307
+
308
+ ```javascript
309
+ // Using a single value (shorthand)
310
+ t.layers.base.filter('brightness', 1.5);
311
+ t.layers.base.filter('hueRotate', 180);
312
+
313
+ // Using an options object
314
+ t.layers.base.filter('contrast', { amount: 0.8 });
315
+ t.layers.base.filter('glitch', { amount: 2.0 });
316
+
317
+ // Chaining multiple filters in sequence
318
+ t.layers.base.filter('brightness', 1.2);
319
+ t.layers.base.filter('contrast', 1.3);
320
+ t.layers.base.filter('hueRotate', 90);
321
+
322
+ // Chromatic aberration with custom direction
323
+ t.layers.base.filter('chromaticAberration', { amount: 10, direction: [1, 1] });
324
+
325
+ // Pixelate effect
326
+ t.layers.base.filter('pixelate', 8);
327
+
328
+ // Vignette with custom shape
329
+ t.layers.base.filter('vignette', { amount: 0.7, softness: 0.4, roundness: 1.0 });
330
+
331
+ // Bloom for glowing bright areas
332
+ t.layers.base.filter('bloom', { threshold: 0.6, intensity: 1.5, radius: 8 });
333
+
334
+ // Film grain with animation
335
+ let time = 0;
336
+ t.draw(() => {
337
+ t.layers.base.filter('filmGrain', { intensity: 0.3, size: 2, speed: 1.0, time: time });
338
+ time += 0.016;
339
+ });
340
+
341
+ // Saturation adjustments
342
+ t.layers.base.filter('saturation', 0); // Grayscale
343
+ t.layers.base.filter('saturation', 1.5); // Vivid colors
344
+
345
+ // Posterize effect (quantize colors)
346
+ t.layers.base.filter('posterize', { levels: 4 });
347
+ ```
348
+
349
+ ## Adding custom filters
350
+
351
+ Want to create your own filter? Check out the [Contributing Guide](CONTRIBUTING.md) for detailed instructions on how to add new filters to this library!
352
+
353
+ The basic structure of a filter shader:
354
+
355
+ ```glsl
356
+ #version 300 es
357
+ precision highp float;
358
+
359
+ uniform sampler2D u_texture; // Input texture
360
+ uniform vec2 u_resolution; // Canvas resolution
361
+ uniform float u_yourParam; // Your custom parameter
362
+
363
+ in vec2 v_uv;
364
+ out vec4 fragColor;
365
+
366
+ void main() {
367
+ vec4 color = texture(u_texture, v_uv);
368
+
369
+ // Your filter logic here
370
+ vec3 result = color.rgb; // Modify this!
371
+
372
+ fragColor = vec4(result, color.a);
373
+ }
374
+ ```
375
+
376
+ ## Contributing
377
+
378
+ Contributions are welcome and greatly appreciated! 🎉
379
+
380
+ Whether you want to:
381
+
382
+ - 🐛 Report a bug
383
+ - 💡 Suggest a new filter
384
+ - 🔧 Submit a pull request
385
+ - 📖 Improve documentation
386
+
387
+ Please read our [Contributing Guide](CONTRIBUTING.md) to get started.
388
+
389
+ ## Related projects
390
+
391
+ - **[textmode.js](https://github.com/humanbydefinition/textmode.js)** - The main textmode.js library
392
+ - **[code.textmode.art](https://code.textmode.art/)** - Documentation & examples
393
+ - **[editor.textmode.art](https://editor.textmode.art/)** - textmode.js web editor
394
+
395
+ ---
396
+
397
+ <div align="center">
398
+
399
+ <br />
400
+
401
+ **[↑ back to top](#textmodefiltersjs)**
402
+
403
+ </div>
@@ -91,3 +91,10 @@ export declare const FiltersPlugin: TextmodePlugin;
91
91
  * @returns A textmode.js plugin instance.
92
92
  */
93
93
  export declare const createFiltersPlugin: () => TextmodePlugin;
94
+ declare global {
95
+ interface Window {
96
+ FiltersPlugin?: TextmodePlugin;
97
+ createFiltersPlugin?: typeof createFiltersPlugin;
98
+ }
99
+ }
100
+ //# 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,qBAAqB,CAAC;AAG1D,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;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,6 +4,7 @@
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
9
  * ```javascript
9
10
  * const t = textmode.create({
@@ -15,7 +16,7 @@
15
16
  * let video;
16
17
  *
17
18
  * t.setup(async () => {
18
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
19
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
19
20
  * video.play();
20
21
  * video.loop();
21
22
  * video.characters(' .:-=+*#%@');
@@ -46,6 +47,7 @@
46
47
  * Configuration options for the `'brightness'` filter.
47
48
  *
48
49
  * Adjusts image brightness by multiplying pixel values.
50
+ *
49
51
  * @example
50
52
  * ```javascript
51
53
  * const t = textmode.create({
@@ -57,7 +59,7 @@
57
59
  * let video;
58
60
  *
59
61
  * t.setup(async () => {
60
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
62
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
61
63
  * video.play();
62
64
  * video.loop();
63
65
  * video.characters(' .:-=+*#%@');
@@ -99,6 +101,7 @@ export interface BrightnessOptions {
99
101
  * Configuration options for the `'contrast'` filter.
100
102
  *
101
103
  * Adjusts image contrast by scaling pixel values around mid-gray.
104
+ *
102
105
  * @example
103
106
  * ```javascript
104
107
  * const t = textmode.create({
@@ -110,7 +113,7 @@ export interface BrightnessOptions {
110
113
  * let video;
111
114
  *
112
115
  * t.setup(async () => {
113
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
116
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
114
117
  * video.play();
115
118
  * video.loop();
116
119
  * video.characters(' .:-=+*#%@');
@@ -153,6 +156,7 @@ export interface ContrastOptions {
153
156
  *
154
157
  * Adjusts color intensity without affecting luminance.
155
158
  * Perfect for creating vivid, oversaturated looks or desaturating to grayscale.
159
+ *
156
160
  * @example
157
161
  * ```javascript
158
162
  * const t = textmode.create({
@@ -164,7 +168,7 @@ export interface ContrastOptions {
164
168
  * let video;
165
169
  *
166
170
  * t.setup(async () => {
167
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
171
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
168
172
  * video.play();
169
173
  * video.loop();
170
174
  * video.characters(' .:-=+*#%@');
@@ -206,6 +210,7 @@ export interface SaturationOptions {
206
210
  *
207
211
  * Shifts all colors around the color wheel by a specified angle.
208
212
  * Useful for color grading or creating surreal color effects.
213
+ *
209
214
  * @example
210
215
  * ```javascript
211
216
  * const t = textmode.create({
@@ -217,7 +222,7 @@ export interface SaturationOptions {
217
222
  * let video;
218
223
  *
219
224
  * t.setup(async () => {
220
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
225
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
221
226
  * video.play();
222
227
  * video.loop();
223
228
  * video.characters(' .:-=+*#%@');
@@ -262,6 +267,7 @@ export interface HueRotateOptions {
262
267
  *
263
268
  * Reduces the color palette to a limited number of bands per channel,
264
269
  * creating a retro quantized/poster-like look.
270
+ *
265
271
  * @example
266
272
  * ```javascript
267
273
  * const t = textmode.create({
@@ -273,7 +279,7 @@ export interface HueRotateOptions {
273
279
  * let video;
274
280
  *
275
281
  * t.setup(async () => {
276
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
282
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
277
283
  * video.play();
278
284
  * video.loop();
279
285
  * video.characters(' .:-=+*#%@');
@@ -318,6 +324,7 @@ export interface PosterizeOptions {
318
324
  *
319
325
  * RGB color channel separation effect that simulates lens distortion
320
326
  * found in cheap cameras or creates stylized glitch aesthetics.
327
+ *
321
328
  * @example
322
329
  * ```javascript
323
330
  * const t = textmode.create({
@@ -329,7 +336,7 @@ export interface PosterizeOptions {
329
336
  * let video;
330
337
  *
331
338
  * t.setup(async () => {
332
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
339
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
333
340
  * video.play();
334
341
  * video.loop();
335
342
  * video.characters(' .:-=+*#%@');
@@ -382,6 +389,7 @@ export interface ChromaticAberrationOptions {
382
389
  *
383
390
  * Reduces image resolution to create a mosaic/pixelated effect
384
391
  * reminiscent of retro video games or censored content.
392
+ *
385
393
  * @example
386
394
  * ```javascript
387
395
  * const t = textmode.create({
@@ -393,7 +401,7 @@ export interface ChromaticAberrationOptions {
393
401
  * let video;
394
402
  *
395
403
  * t.setup(async () => {
396
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
404
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
397
405
  * video.play();
398
406
  * video.loop();
399
407
  * video.characters(' .:-=+*#%@');
@@ -439,6 +447,7 @@ export interface PixelateOptions {
439
447
  *
440
448
  * This filter is designed specifically for textmode.js grids, allowing
441
449
  * you to create dynamic text distortion effects.
450
+ *
442
451
  * @example
443
452
  * ```javascript
444
453
  * const t = textmode.create({
@@ -450,7 +459,7 @@ export interface PixelateOptions {
450
459
  * let video;
451
460
  *
452
461
  * t.setup(async () => {
453
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
462
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
454
463
  * video.play();
455
464
  * video.loop();
456
465
  * video.characters(' .:-=+*#%@');
@@ -557,6 +566,7 @@ export interface GridDistortionOptions {
557
566
  *
558
567
  * Digital glitch effect with RGB channel separation, scanlines, and noise.
559
568
  * Creates a corrupted/broken digital signal aesthetic.
569
+ *
560
570
  * @example
561
571
  * ```javascript
562
572
  * const t = textmode.create({
@@ -568,7 +578,7 @@ export interface GridDistortionOptions {
568
578
  * let video;
569
579
  *
570
580
  * t.setup(async () => {
571
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
581
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
572
582
  * video.play();
573
583
  * video.loop();
574
584
  * video.characters(' .:-=+*#%@');
@@ -611,6 +621,7 @@ export interface GlitchOptions {
611
621
  * CRT monitor emulation effect with screen curvature, animated scanlines,
612
622
  * blur, vignette, and film grain noise. Based on Mattias Gustavsson's
613
623
  * classic CRT shader.
624
+ *
614
625
  * @example
615
626
  * ```javascript
616
627
  * const t = textmode.create({
@@ -622,7 +633,7 @@ export interface GlitchOptions {
622
633
  * let video;
623
634
  *
624
635
  * t.setup(async () => {
625
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
636
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
626
637
  * video.play();
627
638
  * video.loop();
628
639
  * video.characters(' .:-=+*#%@');
@@ -686,6 +697,7 @@ export interface CrtMattiasOptions {
686
697
  * A standalone scanline effect that adds horizontal lines to the image
687
698
  * to simulate a CRT display or old monitor. More customizable than
688
699
  * the scanlines in crtMattias.
700
+ *
689
701
  * @example
690
702
  * ```javascript
691
703
  * const t = textmode.create({
@@ -697,7 +709,7 @@ export interface CrtMattiasOptions {
697
709
  * let video;
698
710
  *
699
711
  * t.setup(async () => {
700
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
712
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
701
713
  * video.play();
702
714
  * video.loop();
703
715
  * video.characters(' .:-=+*#%@');
@@ -781,6 +793,7 @@ export interface ScanlinesOptions {
781
793
  *
782
794
  * Darkens the edges and corners of the image, drawing focus to the center.
783
795
  * Useful for creating a cinematic look or highlighting central content.
796
+ *
784
797
  * @example
785
798
  * ```javascript
786
799
  * const t = textmode.create({
@@ -792,7 +805,7 @@ export interface ScanlinesOptions {
792
805
  * let video;
793
806
  *
794
807
  * t.setup(async () => {
795
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
808
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
796
809
  * video.play();
797
810
  * video.loop();
798
811
  * video.characters(' .:-=+*#%@');
@@ -857,6 +870,7 @@ export interface VignetteOptions {
857
870
  * Creates a glow effect around bright areas of the image. Pixels above
858
871
  * the brightness threshold emit a soft glow that spreads outward.
859
872
  * Perfect for creating neon, glowing text, or dreamy effects.
873
+ *
860
874
  * @example
861
875
  * ```javascript
862
876
  * const t = textmode.create({
@@ -868,7 +882,7 @@ export interface VignetteOptions {
868
882
  * let video;
869
883
  *
870
884
  * t.setup(async () => {
871
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
885
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
872
886
  * video.play();
873
887
  * video.loop();
874
888
  * video.characters(' .:-=+*#%@');
@@ -936,6 +950,7 @@ export interface BloomOptions {
936
950
  * film stock or analog video. The multi-layered noise creates an organic,
937
951
  * moving grain pattern that's less visible in darker areas, mimicking
938
952
  * real film characteristics.
953
+ *
939
954
  * @example
940
955
  * ```javascript
941
956
  * const t = textmode.create({
@@ -947,7 +962,7 @@ export interface BloomOptions {
947
962
  * let video;
948
963
  *
949
964
  * t.setup(async () => {
950
- * video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
965
+ * video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
951
966
  * video.play();
952
967
  * video.loop();
953
968
  * video.characters(' .:-=+*#%@');
@@ -1015,3 +1030,4 @@ export interface FilmGrainOptions {
1015
1030
  */
1016
1031
  time: number;
1017
1032
  }
1033
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,49 +1,78 @@
1
- {
2
- "name": "textmode.filters.js",
3
- "version": "1.1.1",
4
- "description": "Image filters plugin for textmode.js",
5
- "type": "module",
6
- "main": "./dist/textmode.filters.umd.js",
7
- "module": "./dist/textmode.filters.esm.js",
8
- "types": "./dist/types/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/types/index.d.ts",
12
- "import": "./dist/textmode.filters.esm.js",
13
- "require": "./dist/textmode.filters.umd.js"
14
- }
15
- },
16
- "files": [
17
- "dist"
18
- ],
19
- "scripts": {
20
- "build": "vite build && tsc -p tsconfig.json",
21
- "dev": "vite --port 5179 --host",
22
- "format": "prettier --write \"src/**/*.{ts,js}\"",
23
- "format:check": "prettier --check \"src/**/*.{ts,js}\"",
24
- "build:docs": "typedoc",
25
- "dev:docs": "typedoc --watch"
26
- },
27
- "dependencies": {
28
- "textmode.js": ">=0.9.1"
29
- },
30
- "devDependencies": {
31
- "@mapwhit/glsl-minify": "^1.0.0",
32
- "@rollup/plugin-terser": "^0.4.4",
33
- "@types/node": "^24.10.1",
34
- "prettier": "^3.8.1",
35
- "tslib": "^2.8.1",
36
- "typescript": "^5.9.2",
37
- "vite": "^6.3.4",
38
- "typedoc": "^0.28.13",
39
- "typedoc-plugin-frontmatter": "^1.3.1",
40
- "typedoc-plugin-markdown": "^4.9.0",
41
- "typedoc-vitepress-theme": "^1.1.2"
42
- },
43
- "license": "MIT",
44
- "author": "humanbydefinition",
45
- "repository": {
46
- "type": "git",
47
- "url": "https://github.com/humanbydefinition/textmode.filters.js"
48
- }
49
- }
1
+ {
2
+ "name": "textmode.filters.js",
3
+ "version": "1.2.0",
4
+ "description": "Image filters plugin for textmode.js",
5
+ "type": "module",
6
+ "main": "./dist/textmode.filters.umd.js",
7
+ "module": "./dist/textmode.filters.esm.js",
8
+ "types": "./dist/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "import": "./dist/textmode.filters.esm.js",
13
+ "require": "./dist/textmode.filters.umd.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "dev": "vite --port 5179 --host",
21
+ "build": "vite build && tsc -p tsconfig.json",
22
+ "check": "npm run format:check && npm run lint && npm run lint:md && npm run typecheck && npm run build",
23
+ "dev:docs": "typedoc --watch",
24
+ "build:docs": "typedoc",
25
+ "preview": "vite preview",
26
+ "format": "prettier --write \"src/**/*.{ts,js}\" \"vite-plugins/**/*.ts\" \"typedoc-plugins/**/*.js\" \"examples/**/*.{js,html,css}\" \"*.{js,ts,json}\" \".markdownlint*.jsonc\" \".prettierrc\" \".releaserc.json\"",
27
+ "format:check": "prettier --check \"src/**/*.{ts,js}\" \"vite-plugins/**/*.ts\" \"typedoc-plugins/**/*.js\" \"examples/**/*.{js,html,css}\" \"*.{js,ts,json}\" \".markdownlint*.jsonc\" \".prettierrc\" \".releaserc.json\"",
28
+ "typecheck": "tsc --noEmit",
29
+ "lint:md": "markdownlint-cli2",
30
+ "lint:md:fix": "markdownlint-cli2 --fix",
31
+ "lint": "eslint src --config eslint.config.js",
32
+ "prepare": "husky"
33
+ },
34
+ "peerDependencies": {
35
+ "textmode.js": ">=0.7.0"
36
+ },
37
+ "devDependencies": {
38
+ "@commitlint/cli": "^20.3.1",
39
+ "@commitlint/config-conventional": "^20.3.1",
40
+ "@eslint/js": "^9.39.4",
41
+ "@mapwhit/glsl-minify": "^1.0.0",
42
+ "@rollup/plugin-terser": "^0.4.4",
43
+ "@semantic-release/commit-analyzer": "^13.0.1",
44
+ "@semantic-release/exec": "^7.1.0",
45
+ "@semantic-release/github": "^12.0.6",
46
+ "@semantic-release/npm": "^13.1.5",
47
+ "@semantic-release/release-notes-generator": "^14.1.0",
48
+ "@types/node": "^24.0.13",
49
+ "eslint": "^9.39.2",
50
+ "eslint-plugin-jsdoc": "^62.4.1",
51
+ "globals": "^17.1.0",
52
+ "husky": "^9.1.7",
53
+ "lint-staged": "^16.4.0",
54
+ "markdownlint-cli2": "^0.20.0",
55
+ "markdownlint-cli2-formatter-default": "^0.0.6",
56
+ "prettier": "^3.7.4",
57
+ "semantic-release": "^25.0.3",
58
+ "textmode.js": "^0.12.0",
59
+ "tslib": "^2.8.1",
60
+ "typedoc": "^0.28.13",
61
+ "typedoc-plugin-frontmatter": "^1.3.1",
62
+ "typedoc-plugin-markdown": "^4.9.0",
63
+ "typedoc-vitepress-theme": "^1.1.2",
64
+ "typescript": "^5.9.2",
65
+ "typescript-eslint": "^8.53.1",
66
+ "vite": "^6.3.4"
67
+ },
68
+ "license": "MIT",
69
+ "author": "humanbydefinition",
70
+ "lint-staged": {
71
+ "**/*.{ts,js,json,jsonc,html,css}": "prettier --write",
72
+ ".*.{js,json,jsonc}": "prettier --write"
73
+ },
74
+ "repository": {
75
+ "type": "git",
76
+ "url": "https://github.com/humanbydefinition/textmode.filters.js"
77
+ }
78
+ }