textmode.synth.js 1.0.0-beta.1 → 1.0.0-beta.3
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 +661 -0
- package/README.md +104 -121
- package/dist/textmode.synth.esm.js +491 -410
- package/dist/textmode.synth.umd.js +31 -52
- package/dist/types/api/index.d.ts +7 -0
- package/dist/types/api/index.d.ts.map +1 -0
- package/dist/types/api/sources.d.ts +327 -0
- package/dist/types/api/sources.d.ts.map +1 -0
- package/dist/types/augmentations/index.d.ts +7 -0
- package/dist/types/augmentations/index.d.ts.map +1 -0
- package/dist/types/augmentations/textmode.d.ts +65 -0
- package/dist/types/augmentations/textmode.d.ts.map +1 -0
- package/dist/types/bootstrap.d.ts +11 -0
- package/dist/types/bootstrap.d.ts.map +1 -0
- package/dist/types/compiler/ExternalLayerManager.d.ts +60 -0
- package/dist/types/compiler/ExternalLayerManager.d.ts.map +1 -0
- package/dist/types/compiler/FeedbackTracker.d.ts +53 -0
- package/dist/types/compiler/FeedbackTracker.d.ts.map +1 -0
- package/dist/types/compiler/GLSLGenerator.d.ts +2 -2
- package/dist/types/compiler/GLSLGenerator.d.ts.map +1 -1
- package/dist/types/compiler/SynthCompiler.d.ts +7 -1
- package/dist/types/compiler/SynthCompiler.d.ts.map +1 -1
- package/dist/types/compiler/TransformCodeGenerator.d.ts +77 -0
- package/dist/types/compiler/TransformCodeGenerator.d.ts.map +1 -0
- package/dist/types/compiler/UniformManager.d.ts.map +1 -1
- package/dist/types/compiler/index.d.ts +14 -3
- package/dist/types/compiler/index.d.ts.map +1 -1
- package/dist/types/compiler/types.d.ts +7 -7
- package/dist/types/compiler/types.d.ts.map +1 -1
- package/dist/types/core/GlobalState.d.ts +30 -0
- package/dist/types/core/GlobalState.d.ts.map +1 -0
- package/dist/types/core/ISynthSource.d.ts +173 -202
- package/dist/types/core/ISynthSource.d.ts.map +1 -1
- package/dist/types/core/SynthChain.d.ts +0 -2
- package/dist/types/core/SynthChain.d.ts.map +1 -1
- package/dist/types/core/SynthSource.d.ts +4 -3
- package/dist/types/core/SynthSource.d.ts.map +1 -1
- package/dist/types/core/index.d.ts +9 -3
- package/dist/types/core/index.d.ts.map +1 -1
- package/dist/types/core/types.d.ts +57 -4
- package/dist/types/core/types.d.ts.map +1 -1
- package/dist/types/extensions/index.d.ts +10 -0
- package/dist/types/extensions/index.d.ts.map +1 -0
- package/dist/types/extensions/textmodelayer.d.ts +22 -0
- package/dist/types/extensions/textmodelayer.d.ts.map +1 -0
- package/dist/types/extensions/textmodifier.d.ts +11 -0
- package/dist/types/extensions/textmodifier.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -364
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lifecycle/index.d.ts +10 -0
- package/dist/types/lifecycle/index.d.ts.map +1 -0
- package/dist/types/lifecycle/synthDispose.d.ts +11 -0
- package/dist/types/lifecycle/synthDispose.d.ts.map +1 -0
- package/dist/types/lifecycle/synthRender.d.ts +11 -0
- package/dist/types/lifecycle/synthRender.d.ts.map +1 -0
- package/dist/types/{SynthPlugin.d.ts → plugin/SynthPlugin.d.ts} +1 -1
- package/dist/types/plugin/SynthPlugin.d.ts.map +1 -0
- package/dist/types/plugin/constants.d.ts +5 -0
- package/dist/types/plugin/constants.d.ts.map +1 -0
- package/dist/types/plugin/index.d.ts +10 -0
- package/dist/types/plugin/index.d.ts.map +1 -0
- package/dist/types/transforms/TransformDefinition.d.ts +0 -12
- package/dist/types/transforms/TransformDefinition.d.ts.map +1 -1
- package/dist/types/transforms/TransformFactory.d.ts +4 -7
- package/dist/types/transforms/TransformFactory.d.ts.map +1 -1
- package/dist/types/transforms/TransformRegistry.d.ts +3 -6
- package/dist/types/transforms/TransformRegistry.d.ts.map +1 -1
- package/dist/types/transforms/categories/colors.d.ts +1 -1
- package/dist/types/transforms/categories/colors.d.ts.map +1 -1
- package/dist/types/transforms/categories/combine.d.ts.map +1 -1
- package/dist/types/transforms/categories/index.d.ts +3 -4
- package/dist/types/transforms/categories/index.d.ts.map +1 -1
- package/dist/types/transforms/categories/sources.d.ts.map +1 -1
- package/dist/types/{lib → utils}/ArrayUtils.d.ts +20 -5
- package/dist/types/utils/ArrayUtils.d.ts.map +1 -0
- package/dist/types/utils/CharacterResolver.d.ts.map +1 -1
- package/dist/types/utils/collectExternalLayerRefs.d.ts +7 -0
- package/dist/types/utils/collectExternalLayerRefs.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +12 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/package.json +16 -9
- package/dist/types/SynthPlugin.d.ts.map +0 -1
- package/dist/types/lib/ArrayUtils.d.ts.map +0 -1
- package/dist/types/transforms/categories/charModifiers.d.ts +0 -16
- package/dist/types/transforms/categories/charModifiers.d.ts.map +0 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { SynthParameterValue } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Interface defining all chainable methods available on SynthSource.
|
|
4
|
+
*
|
|
5
|
+
* This interface serves as the authoritative documentation for all
|
|
6
|
+
* synthesis methods.
|
|
7
|
+
*/
|
|
2
8
|
export interface ISynthSource {
|
|
3
9
|
/**
|
|
4
10
|
* Map character indices to a specific character set.
|
|
@@ -12,8 +18,8 @@ export interface ISynthSource {
|
|
|
12
18
|
* // Map noise values to ASCII art characters
|
|
13
19
|
* noise(10).charMap('@#%*+=-:. ')
|
|
14
20
|
*
|
|
15
|
-
* // Use
|
|
16
|
-
* osc(1).charMap('
|
|
21
|
+
* // Use lowercase alphabet characters
|
|
22
|
+
* osc(1).charMap('abcdefghijklmnopqrstuvwxyz')
|
|
17
23
|
*
|
|
18
24
|
* // Use custom symbols
|
|
19
25
|
* gradient().charMap('-<>^v')
|
|
@@ -68,7 +74,7 @@ export interface ISynthSource {
|
|
|
68
74
|
* char(noise(10), 16)
|
|
69
75
|
*
|
|
70
76
|
* // Use oscillator to select characters
|
|
71
|
-
* char(osc(5),
|
|
77
|
+
* char(osc(5), 32)
|
|
72
78
|
* ```
|
|
73
79
|
*/
|
|
74
80
|
char(source: ISynthSource, charCount: number): this;
|
|
@@ -124,32 +130,37 @@ export interface ISynthSource {
|
|
|
124
130
|
* @param sync - Synchronization offset (default: 0.1)
|
|
125
131
|
* @param offset - Phase offset (default: 0.0)
|
|
126
132
|
*/
|
|
127
|
-
osc
|
|
133
|
+
osc(frequency?: SynthParameterValue, sync?: SynthParameterValue, offset?: SynthParameterValue): this;
|
|
128
134
|
/**
|
|
129
135
|
* Generate Perlin noise patterns.
|
|
130
136
|
* @param scale - Scale of the noise pattern (default: 10.0)
|
|
131
137
|
* @param speed - Animation speed (default: 0.1)
|
|
132
138
|
*/
|
|
133
|
-
noise
|
|
139
|
+
noise(scale?: SynthParameterValue, speed?: SynthParameterValue): this;
|
|
134
140
|
/**
|
|
135
|
-
* Generate
|
|
136
|
-
* @param scale - Scale of
|
|
141
|
+
* Generate voronoi patterns.
|
|
142
|
+
* @param scale - Scale of voronoi cells (default: 5.0)
|
|
137
143
|
* @param speed - Animation speed (default: 0.3)
|
|
138
144
|
* @param blending - Blending between cell regions (default: 0.3)
|
|
139
145
|
*/
|
|
140
|
-
voronoi
|
|
146
|
+
voronoi(scale?: SynthParameterValue, speed?: SynthParameterValue, blending?: SynthParameterValue): this;
|
|
141
147
|
/**
|
|
142
148
|
* Generate a rotating radial gradient.
|
|
143
149
|
* @param speed - Rotation speed (default: 0.0)
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* gradient([1,2,4])
|
|
154
|
+
* ```
|
|
144
155
|
*/
|
|
145
|
-
gradient
|
|
156
|
+
gradient(speed?: SynthParameterValue): this;
|
|
146
157
|
/**
|
|
147
158
|
* Generate geometric shapes (polygons).
|
|
148
159
|
* @param sides - Number of sides (default: 3)
|
|
149
160
|
* @param radius - Radius of the shape (default: 0.3)
|
|
150
161
|
* @param smoothing - Edge smoothing amount (default: 0.01)
|
|
151
162
|
*/
|
|
152
|
-
shape
|
|
163
|
+
shape(sides?: SynthParameterValue, radius?: SynthParameterValue, smoothing?: SynthParameterValue): this;
|
|
153
164
|
/**
|
|
154
165
|
* Generate a solid color.
|
|
155
166
|
* @param r - Red channel (0-1, default: 0.0)
|
|
@@ -157,7 +168,7 @@ export interface ISynthSource {
|
|
|
157
168
|
* @param b - Blue channel (0-1, default: 0.0)
|
|
158
169
|
* @param a - Alpha channel (0-1, default: 1.0)
|
|
159
170
|
*/
|
|
160
|
-
solid
|
|
171
|
+
solid(r?: SynthParameterValue, g?: SynthParameterValue, b?: SynthParameterValue, a?: SynthParameterValue): this;
|
|
161
172
|
/**
|
|
162
173
|
* Sample the previous frame for feedback effects, or sample from another layer.
|
|
163
174
|
*
|
|
@@ -191,25 +202,9 @@ export interface ISynthSource {
|
|
|
191
202
|
* char(noise(10).diff(src())) // src() → character feedback
|
|
192
203
|
* .charColor(osc(5).blend(src(), 0.5)) // src() → primary color feedback
|
|
193
204
|
* .cellColor(voronoi().diff(src())) // src() → cell color feedback
|
|
194
|
-
*
|
|
195
|
-
* // Cross-layer sampling (hydra-style o0, o1, o2, o3)
|
|
196
|
-
* const layer1 = t.layers.add();
|
|
197
|
-
* const layer2 = t.layers.add();
|
|
198
|
-
*
|
|
199
|
-
* layer1.synth(noise(10).mult(osc(20)));
|
|
200
|
-
*
|
|
201
|
-
* layer2.synth(
|
|
202
|
-
* char(voronoi(5).diff(src(layer1))) // Sample layer1's char texture
|
|
203
|
-
* .charColor(osc(10).blend(src(layer1), 0.5)) // Sample layer1's primary color
|
|
204
|
-
* );
|
|
205
|
-
*
|
|
206
|
-
* // Complex multi-layer composition
|
|
207
|
-
* t.layers.base.synth(
|
|
208
|
-
* noise(3, 0.3).thresh(0.3).diff(src(layer2), 0.3)
|
|
209
|
-
* );
|
|
210
205
|
* ```
|
|
211
206
|
*/
|
|
212
|
-
src
|
|
207
|
+
src(layer?: unknown): this;
|
|
213
208
|
/**
|
|
214
209
|
* Rotate coordinates.
|
|
215
210
|
* @param angle - Rotation angle in radians (default: 10.0)
|
|
@@ -218,12 +213,12 @@ export interface ISynthSource {
|
|
|
218
213
|
* @example
|
|
219
214
|
* ```typescript
|
|
220
215
|
* // Rotate shape continuously
|
|
221
|
-
*
|
|
216
|
+
* osc(50, 0, 0, 16)
|
|
222
217
|
* .rotate((ctx) => ctx.time % 360)
|
|
223
218
|
* .charColor(osc(50).rotate((ctx) => ctx.time % 360));
|
|
224
219
|
* ```
|
|
225
220
|
*/
|
|
226
|
-
rotate
|
|
221
|
+
rotate(angle?: SynthParameterValue, speed?: SynthParameterValue): this;
|
|
227
222
|
/**
|
|
228
223
|
* Scale coordinates.
|
|
229
224
|
* @param amount - Scale amount (default: 1.5)
|
|
@@ -235,10 +230,10 @@ export interface ISynthSource {
|
|
|
235
230
|
* @example
|
|
236
231
|
* ```typescript
|
|
237
232
|
* // Scale a triangle shape
|
|
238
|
-
*
|
|
233
|
+
* shape(3).scale(1.5, 1, 1);
|
|
239
234
|
* ```
|
|
240
235
|
*/
|
|
241
|
-
scale
|
|
236
|
+
scale(amount?: SynthParameterValue, xMult?: SynthParameterValue, yMult?: SynthParameterValue, offsetX?: SynthParameterValue, offsetY?: SynthParameterValue): this;
|
|
242
237
|
/**
|
|
243
238
|
* Scroll coordinates in both X and Y directions.
|
|
244
239
|
* @param scrollX - X scroll amount (default: 0.5)
|
|
@@ -249,22 +244,22 @@ export interface ISynthSource {
|
|
|
249
244
|
* @example
|
|
250
245
|
* ```typescript
|
|
251
246
|
* // Scroll a shape diagonally
|
|
252
|
-
*
|
|
247
|
+
* shape(3).scroll(0.1, -0.3);
|
|
253
248
|
* ```
|
|
254
249
|
*/
|
|
255
|
-
scroll
|
|
250
|
+
scroll(scrollX?: SynthParameterValue, scrollY?: SynthParameterValue, speedX?: SynthParameterValue, speedY?: SynthParameterValue): this;
|
|
256
251
|
/**
|
|
257
252
|
* Scroll coordinates in X direction.
|
|
258
253
|
* @param scrollX - X scroll amount (default: 0.5)
|
|
259
254
|
* @param speed - Scroll speed (default: 0.0)
|
|
260
255
|
*/
|
|
261
|
-
scrollX
|
|
256
|
+
scrollX(scrollX?: SynthParameterValue, speed?: SynthParameterValue): this;
|
|
262
257
|
/**
|
|
263
258
|
* Scroll coordinates in Y direction.
|
|
264
259
|
* @param scrollY - Y scroll amount (default: 0.5)
|
|
265
260
|
* @param speed - Scroll speed (default: 0.0)
|
|
266
261
|
*/
|
|
267
|
-
scrollY
|
|
262
|
+
scrollY(scrollY?: SynthParameterValue, speed?: SynthParameterValue): this;
|
|
268
263
|
/**
|
|
269
264
|
* Pixelate the output.
|
|
270
265
|
* @param pixelX - Pixel size in X (default: 20.0)
|
|
@@ -273,12 +268,12 @@ export interface ISynthSource {
|
|
|
273
268
|
* @example
|
|
274
269
|
* ```typescript
|
|
275
270
|
* // Pixelate noise pattern
|
|
276
|
-
*
|
|
271
|
+
* noise(1, 0.05)
|
|
277
272
|
* .pixelate(20, 20)
|
|
278
273
|
* .charColor(noise().pixelate(20, 20));
|
|
279
274
|
* ```
|
|
280
275
|
*/
|
|
281
|
-
pixelate
|
|
276
|
+
pixelate(pixelX?: SynthParameterValue, pixelY?: SynthParameterValue): this;
|
|
282
277
|
/**
|
|
283
278
|
* Repeat coordinates in both X and Y directions.
|
|
284
279
|
* @param repeatX - Number of X repetitions (default: 3.0)
|
|
@@ -289,24 +284,24 @@ export interface ISynthSource {
|
|
|
289
284
|
* @example
|
|
290
285
|
* ```typescript
|
|
291
286
|
* // Repeat a shape in a 3x3 grid
|
|
292
|
-
*
|
|
287
|
+
* shape(3)
|
|
293
288
|
* .repeat(3, 3, 0, 0)
|
|
294
289
|
* .charColor(shape().repeat(3, 3, 0, 0));
|
|
295
290
|
* ```
|
|
296
291
|
*/
|
|
297
|
-
repeat
|
|
292
|
+
repeat(repeatX?: SynthParameterValue, repeatY?: SynthParameterValue, offsetX?: SynthParameterValue, offsetY?: SynthParameterValue): this;
|
|
298
293
|
/**
|
|
299
294
|
* Repeat coordinates in X direction.
|
|
300
295
|
* @param reps - Number of repetitions (default: 3.0)
|
|
301
296
|
* @param offset - Offset between repetitions (default: 0.0)
|
|
302
297
|
*/
|
|
303
|
-
repeatX
|
|
298
|
+
repeatX(reps?: SynthParameterValue, offset?: SynthParameterValue): this;
|
|
304
299
|
/**
|
|
305
300
|
* Repeat coordinates in Y direction.
|
|
306
301
|
* @param reps - Number of repetitions (default: 3.0)
|
|
307
302
|
* @param offset - Offset between repetitions (default: 0.0)
|
|
308
303
|
*/
|
|
309
|
-
repeatY
|
|
304
|
+
repeatY(reps?: SynthParameterValue, offset?: SynthParameterValue): this;
|
|
310
305
|
/**
|
|
311
306
|
* Apply kaleidoscope effect.
|
|
312
307
|
* @param nSides - Number of kaleidoscope sides (default: 4.0)
|
|
@@ -314,53 +309,50 @@ export interface ISynthSource {
|
|
|
314
309
|
* @example
|
|
315
310
|
* ```typescript
|
|
316
311
|
* // Create a 50-sided kaleidoscope pattern
|
|
317
|
-
*
|
|
312
|
+
* osc(25, -0.1, 0.5, 32)
|
|
318
313
|
* .kaleid(50)
|
|
319
314
|
* .charColor(osc(25, -0.1, 0.5).kaleid(50));
|
|
320
315
|
* ```
|
|
321
316
|
*/
|
|
322
|
-
kaleid
|
|
317
|
+
kaleid(nSides?: SynthParameterValue): this;
|
|
323
318
|
/**
|
|
324
319
|
* Adjust brightness.
|
|
325
320
|
* @param amount - Brightness adjustment amount (default: 0.4)
|
|
326
321
|
*
|
|
327
322
|
* @example
|
|
328
323
|
* ```typescript
|
|
329
|
-
*
|
|
330
|
-
* charOsc(20, 0, 2, 16)
|
|
324
|
+
* osc(1)
|
|
331
325
|
* .charColor(
|
|
332
|
-
* osc(20, 0, 2).brightness((
|
|
333
|
-
* )
|
|
326
|
+
* osc(20, 0, 2).brightness(() => Math.sin(t.secs()))
|
|
327
|
+
* )
|
|
334
328
|
* ```
|
|
335
329
|
*/
|
|
336
|
-
brightness
|
|
330
|
+
brightness(amount?: SynthParameterValue): this;
|
|
337
331
|
/**
|
|
338
332
|
* Adjust contrast.
|
|
339
333
|
* @param amount - Contrast amount (default: 1.6)
|
|
340
334
|
*
|
|
341
335
|
* @example
|
|
342
336
|
* ```typescript
|
|
343
|
-
*
|
|
344
|
-
* charOsc(20, 0.1, 0, 16)
|
|
337
|
+
* osc(1)
|
|
345
338
|
* .charColor(
|
|
346
339
|
* osc(20).contrast((ctx) => Math.sin(ctx.time) * 5)
|
|
347
|
-
* )
|
|
340
|
+
* )
|
|
348
341
|
* ```
|
|
349
342
|
*/
|
|
350
|
-
contrast
|
|
343
|
+
contrast(amount?: SynthParameterValue): this;
|
|
351
344
|
/**
|
|
352
345
|
* Invert colors.
|
|
353
346
|
* @param amount - Inversion amount (default: 1.0)
|
|
354
347
|
*
|
|
355
348
|
* @example
|
|
356
349
|
* ```typescript
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* .cellColor(solid(1, 1, 1).invert([1, 0]));
|
|
350
|
+
* solid(0.2, 0, 0, 1)
|
|
351
|
+
* .charColor(solid(1, 1, 1).invert([0, 1]))
|
|
352
|
+
* .cellColor(solid(1, 1, 1).invert([1, 0]))
|
|
361
353
|
* ```
|
|
362
354
|
*/
|
|
363
|
-
invert
|
|
355
|
+
invert(amount?: SynthParameterValue): this;
|
|
364
356
|
/**
|
|
365
357
|
* Adjust color saturation.
|
|
366
358
|
* @param amount - Saturation amount (default: 2.0)
|
|
@@ -368,32 +360,37 @@ export interface ISynthSource {
|
|
|
368
360
|
* @example
|
|
369
361
|
* ```typescript
|
|
370
362
|
* // Animate saturation
|
|
371
|
-
*
|
|
363
|
+
* osc(10, 0, 1, 16)
|
|
372
364
|
* .charColor(
|
|
373
365
|
* osc(10, 0, 1).saturate((ctx) => Math.sin(ctx.time) * 10)
|
|
374
366
|
* );
|
|
375
367
|
* ```
|
|
376
368
|
*/
|
|
377
|
-
saturate
|
|
369
|
+
saturate(amount?: SynthParameterValue): this;
|
|
378
370
|
/**
|
|
379
371
|
* Shift hue.
|
|
380
372
|
* @param hue - Hue shift amount (default: 0.4)
|
|
381
373
|
*
|
|
382
374
|
* @example
|
|
383
375
|
* ```typescript
|
|
384
|
-
*
|
|
385
|
-
* charOsc(30, 0.1, 1, 16)
|
|
376
|
+
* osc(1)
|
|
386
377
|
* .charColor(
|
|
387
378
|
* osc(30, 0.1, 1).hue((ctx) => Math.sin(ctx.time))
|
|
388
|
-
* )
|
|
379
|
+
* )
|
|
389
380
|
* ```
|
|
390
381
|
*/
|
|
391
|
-
hue
|
|
382
|
+
hue(hue?: SynthParameterValue): this;
|
|
392
383
|
/**
|
|
393
384
|
* Apply colorama effect (hue rotation based on luminance).
|
|
394
385
|
* @param amount - Effect amount (default: 0.005)
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* ```typescript
|
|
389
|
+
* // Create color cycle effect on oscillator
|
|
390
|
+
* noise(4).colorama(0.3)
|
|
391
|
+
* ```
|
|
395
392
|
*/
|
|
396
|
-
colorama
|
|
393
|
+
colorama(amount?: SynthParameterValue): this;
|
|
397
394
|
/**
|
|
398
395
|
* Posterize colors to limited palette.
|
|
399
396
|
* @param bins - Number of color bins (default: 3.0)
|
|
@@ -402,52 +399,90 @@ export interface ISynthSource {
|
|
|
402
399
|
* @example
|
|
403
400
|
* ```typescript
|
|
404
401
|
* // Posterize gradient with array modulation
|
|
405
|
-
*
|
|
402
|
+
* gradient(0, 16)
|
|
406
403
|
* .rotate(1.57)
|
|
407
404
|
* .charColor(
|
|
408
405
|
* gradient(0).posterize([1, 5, 15, 30], 0.5)
|
|
409
406
|
* );
|
|
410
407
|
* ```
|
|
411
408
|
*/
|
|
412
|
-
posterize
|
|
409
|
+
posterize(bins?: SynthParameterValue, gamma?: SynthParameterValue): this;
|
|
413
410
|
/**
|
|
414
411
|
* Apply threshold based on luminance.
|
|
415
412
|
* @param threshold - Threshold value (default: 0.5)
|
|
416
413
|
* @param tolerance - Tolerance range (default: 0.1)
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```typescript
|
|
417
|
+
* // Apply threshold to oscillator
|
|
418
|
+
* osc(10,0,1).luma(0.5,0.1)
|
|
419
|
+
* ```
|
|
417
420
|
*/
|
|
418
|
-
luma
|
|
421
|
+
luma(threshold?: SynthParameterValue, tolerance?: SynthParameterValue): this;
|
|
419
422
|
/**
|
|
420
423
|
* Apply hard threshold.
|
|
421
424
|
* @param threshold - Threshold value (default: 0.5)
|
|
422
425
|
* @param tolerance - Tolerance range (default: 0.04)
|
|
423
426
|
*/
|
|
424
|
-
thresh
|
|
427
|
+
thresh(threshold?: SynthParameterValue, tolerance?: SynthParameterValue): this;
|
|
425
428
|
/**
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
429
|
+
* Colorize a grayscale source or multiply an existing color source.
|
|
430
|
+
*
|
|
431
|
+
* This is the recommended way to add color to grayscale sources like `osc()`,
|
|
432
|
+
* `noise()`, or `voronoi()`.
|
|
433
|
+
*
|
|
434
|
+
* @param r - Red channel multiplier (default: 1.0)
|
|
435
|
+
* @param g - Green channel multiplier (default: 1.0)
|
|
436
|
+
* @param b - Blue channel multiplier (default: 1.0)
|
|
437
|
+
* @param a - Alpha channel multiplier (default: 1.0)
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* ```typescript
|
|
441
|
+
* // Create a blue oscillator
|
|
442
|
+
* osc(10).color(0, 0.5, 1.0)
|
|
443
|
+
*
|
|
444
|
+
* // Colorize noise with a red tint
|
|
445
|
+
* noise(5).color(1, 0.2, 0.2)
|
|
446
|
+
* ```
|
|
431
447
|
*/
|
|
432
|
-
color
|
|
448
|
+
color(r?: SynthParameterValue, g?: SynthParameterValue, b?: SynthParameterValue, a?: SynthParameterValue): this;
|
|
433
449
|
/**
|
|
434
|
-
*
|
|
450
|
+
* Extract the red channel as a grayscale value.
|
|
435
451
|
* @param scale - Scale multiplier (default: 1.0)
|
|
436
452
|
* @param offset - Offset amount (default: 0.0)
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```typescript
|
|
456
|
+
* // Extract red channel as grayscale
|
|
457
|
+
* voronoi(5).hue(0.4).r()
|
|
458
|
+
*
|
|
459
|
+
* // Convert red intensity to character indices
|
|
460
|
+
* char(osc(10).hue(0.5).r(), 16)
|
|
461
|
+
* ```
|
|
437
462
|
*/
|
|
438
|
-
r
|
|
463
|
+
r(scale?: SynthParameterValue, offset?: SynthParameterValue): this;
|
|
439
464
|
/**
|
|
440
|
-
*
|
|
465
|
+
* Extract the green channel as a grayscale value.
|
|
441
466
|
* @param scale - Scale multiplier (default: 1.0)
|
|
442
467
|
* @param offset - Offset amount (default: 0.0)
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```typescript
|
|
471
|
+
* osc(4,0.1,1.5).layer(gradient().g())
|
|
472
|
+
* ```
|
|
443
473
|
*/
|
|
444
|
-
g
|
|
474
|
+
g(scale?: SynthParameterValue, offset?: SynthParameterValue): this;
|
|
445
475
|
/**
|
|
446
|
-
*
|
|
476
|
+
* Extract the blue channel as a grayscale value.
|
|
447
477
|
* @param scale - Scale multiplier (default: 1.0)
|
|
448
478
|
* @param offset - Offset amount (default: 0.0)
|
|
479
|
+
*
|
|
480
|
+
* @example
|
|
481
|
+
* ```typescript
|
|
482
|
+
* osc(8,0.1,1.5).layer(gradient().colorama(1).b())
|
|
483
|
+
* ```
|
|
449
484
|
*/
|
|
450
|
-
b
|
|
485
|
+
b(scale?: SynthParameterValue, offset?: SynthParameterValue): this;
|
|
451
486
|
/**
|
|
452
487
|
* Shift color channels by adding offset values.
|
|
453
488
|
* @param r - Red channel shift (default: 0.5)
|
|
@@ -455,23 +490,18 @@ export interface ISynthSource {
|
|
|
455
490
|
* @param b - Blue channel shift (default: 0.0)
|
|
456
491
|
* @param a - Alpha channel shift (default: 0.0)
|
|
457
492
|
*/
|
|
458
|
-
shift
|
|
493
|
+
shift(r?: SynthParameterValue, g?: SynthParameterValue, b?: SynthParameterValue, a?: SynthParameterValue): this;
|
|
459
494
|
/**
|
|
460
495
|
* Apply gamma correction for nonlinear brightness control.
|
|
461
496
|
* @param amount - Gamma value (default: 1.0, < 1.0 brightens, > 1.0 darkens)
|
|
462
497
|
*
|
|
463
498
|
* @example
|
|
464
499
|
* ```typescript
|
|
465
|
-
*
|
|
466
|
-
* charNoise(10)
|
|
467
|
-
* .charColor(gradient(0).gamma(0.7))
|
|
468
|
-
*
|
|
469
|
-
* // Darken with animation
|
|
470
|
-
* charOsc(8)
|
|
500
|
+
* osc(1)
|
|
471
501
|
* .charColor(osc(5).gamma([1.0, 1.5, 2.0].smooth(4)))
|
|
472
502
|
* ```
|
|
473
503
|
*/
|
|
474
|
-
gamma
|
|
504
|
+
gamma(amount?: SynthParameterValue): this;
|
|
475
505
|
/**
|
|
476
506
|
* Adjust input/output levels and gamma for precise tonal control.
|
|
477
507
|
* @param inMin - Input minimum (default: 0.0)
|
|
@@ -483,15 +513,15 @@ export interface ISynthSource {
|
|
|
483
513
|
* @example
|
|
484
514
|
* ```typescript
|
|
485
515
|
* // Expand tonal range from 0.2-0.8 to 0-1
|
|
486
|
-
*
|
|
516
|
+
* noise(10)
|
|
487
517
|
* .charColor(noise(5).levels(0.2, 0.8, 0.0, 1.0, 1.0))
|
|
488
518
|
*
|
|
489
519
|
* // Compress highlights, boost shadows
|
|
490
|
-
*
|
|
520
|
+
* voronoi(8)
|
|
491
521
|
* .charColor(voronoi(5).levels(0.0, 1.0, 0.2, 0.9, 0.8))
|
|
492
522
|
* ```
|
|
493
523
|
*/
|
|
494
|
-
levels
|
|
524
|
+
levels(inMin?: SynthParameterValue, inMax?: SynthParameterValue, outMin?: SynthParameterValue, outMax?: SynthParameterValue, gamma?: SynthParameterValue): this;
|
|
495
525
|
/**
|
|
496
526
|
* Clamp color values to a specified range for stability.
|
|
497
527
|
* @param min - Minimum value (default: 0.0)
|
|
@@ -499,18 +529,10 @@ export interface ISynthSource {
|
|
|
499
529
|
*
|
|
500
530
|
* @example
|
|
501
531
|
* ```typescript
|
|
502
|
-
*
|
|
503
|
-
* charOsc(10)
|
|
504
|
-
* .charColor(
|
|
505
|
-
* osc(5).add(osc(8), 0.8).add(osc(12), 0.6).clampColor(0.0, 1.0)
|
|
506
|
-
* )
|
|
507
|
-
*
|
|
508
|
-
* // Create hard clip effect
|
|
509
|
-
* charNoise(8)
|
|
510
|
-
* .charColor(noise(5).brightness(0.5).clampColor(0.3, 0.7))
|
|
532
|
+
* osc(5).add(osc(8), 0.8).add(osc(12), 0.6).clamp(0.2, 0.8)
|
|
511
533
|
* ```
|
|
512
534
|
*/
|
|
513
|
-
|
|
535
|
+
clamp(min?: SynthParameterValue, max?: SynthParameterValue): this;
|
|
514
536
|
/**
|
|
515
537
|
* Add another source.
|
|
516
538
|
* @param source - Source to add
|
|
@@ -519,28 +541,24 @@ export interface ISynthSource {
|
|
|
519
541
|
* @example
|
|
520
542
|
* ```typescript
|
|
521
543
|
* // Add two shapes with animated blend amount
|
|
522
|
-
*
|
|
544
|
+
* shape(3)
|
|
523
545
|
* .scale(0.5)
|
|
524
|
-
* .
|
|
525
|
-
* shape(3)
|
|
526
|
-
* .scale(0.5)
|
|
527
|
-
* .add(shape(4).scale(2), [0, 0.25, 0.5, 0.75, 1])
|
|
528
|
-
* );
|
|
546
|
+
* .add(shape(4).scale(2), [0, 0.25, 0.5, 0.75, 1])
|
|
529
547
|
* ```
|
|
530
548
|
*/
|
|
531
|
-
add
|
|
549
|
+
add(source: ISynthSource, amount?: SynthParameterValue): this;
|
|
532
550
|
/**
|
|
533
551
|
* Subtract another source.
|
|
534
552
|
* @param source - Source to subtract
|
|
535
553
|
* @param amount - Blend amount (default: 0.5)
|
|
536
554
|
*/
|
|
537
|
-
sub
|
|
555
|
+
sub(source: ISynthSource, amount?: SynthParameterValue): this;
|
|
538
556
|
/**
|
|
539
557
|
* Multiply with another source.
|
|
540
558
|
* @param source - Source to multiply
|
|
541
559
|
* @param amount - Blend amount (default: 0.5)
|
|
542
560
|
*/
|
|
543
|
-
mult
|
|
561
|
+
mult(source: ISynthSource, amount?: SynthParameterValue): this;
|
|
544
562
|
/**
|
|
545
563
|
* Blend with another source.
|
|
546
564
|
* @param source - Source to blend
|
|
@@ -549,35 +567,34 @@ export interface ISynthSource {
|
|
|
549
567
|
* @example
|
|
550
568
|
* ```typescript
|
|
551
569
|
* // Blend two shapes
|
|
552
|
-
*
|
|
570
|
+
* shape(3)
|
|
553
571
|
* .scale(0.5)
|
|
554
|
-
* .
|
|
555
|
-
* shape(3)
|
|
556
|
-
* .scale(0.5)
|
|
557
|
-
* .blend(shape(4).scale(2), [0, 0.25, 0.5, 0.75, 1])
|
|
558
|
-
* );
|
|
572
|
+
* .blend(shape(4).scale(2), [0, 0.25, 0.5, 0.75, 1])
|
|
559
573
|
* ```
|
|
560
574
|
*/
|
|
561
|
-
blend
|
|
575
|
+
blend(source: ISynthSource, amount?: SynthParameterValue): this;
|
|
562
576
|
/**
|
|
563
577
|
* Difference with another source.
|
|
564
578
|
* @param source - Source to compare
|
|
565
579
|
*
|
|
566
580
|
* @example
|
|
567
581
|
* ```typescript
|
|
568
|
-
*
|
|
569
|
-
* charOsc(9, 0.1, 2, 16)
|
|
570
|
-
* .charColor(
|
|
571
|
-
* osc(9, 0.1, 2).diff(osc(13, 0.5, 5))
|
|
572
|
-
* );
|
|
582
|
+
* osc(1, 0.1, 2).diff(osc(1, 0.5, 5))
|
|
573
583
|
* ```
|
|
574
584
|
*/
|
|
575
|
-
diff
|
|
585
|
+
diff(source: ISynthSource): this;
|
|
576
586
|
/**
|
|
577
587
|
* Layer another source on top.
|
|
578
588
|
* @param source - Source to layer
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```typescript
|
|
592
|
+
* osc(1)
|
|
593
|
+
* .charColor(osc(30).layer(osc(15).rotate(1).luma()))
|
|
594
|
+
* .cellColor(osc(30).layer(osc(15).rotate(1).luma()).invert())
|
|
595
|
+
* ```
|
|
579
596
|
*/
|
|
580
|
-
layer
|
|
597
|
+
layer(source: ISynthSource): this;
|
|
581
598
|
/**
|
|
582
599
|
* Mask using another source.
|
|
583
600
|
* @param source - Source to use as mask
|
|
@@ -585,13 +602,10 @@ export interface ISynthSource {
|
|
|
585
602
|
* @example
|
|
586
603
|
* ```typescript
|
|
587
604
|
* // Mask gradient with voronoi pattern
|
|
588
|
-
*
|
|
589
|
-
* .charColor(
|
|
590
|
-
* gradient(5).mask(voronoi()).invert([0, 1])
|
|
591
|
-
* );
|
|
605
|
+
* gradient(5).mask(voronoi()).invert([0, 1])
|
|
592
606
|
* ```
|
|
593
607
|
*/
|
|
594
|
-
mask
|
|
608
|
+
mask(source: ISynthSource): this;
|
|
595
609
|
/**
|
|
596
610
|
* Modulate coordinates using another source.
|
|
597
611
|
* @param source - Modulation source
|
|
@@ -599,120 +613,77 @@ export interface ISynthSource {
|
|
|
599
613
|
*
|
|
600
614
|
* @example
|
|
601
615
|
* ```typescript
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
* .rotate((ctx) => (ctx.time % 360) / 2)
|
|
605
|
-
* .modulate(
|
|
606
|
-
* osc(25, 0.1, 0.5)
|
|
607
|
-
* .kaleid(50)
|
|
608
|
-
* .scale((ctx) => Math.sin(ctx.time) * 0.5 + 1)
|
|
609
|
-
* .modulate(noise(0.6, 0.5)),
|
|
610
|
-
* 0.5
|
|
611
|
-
* );
|
|
616
|
+
* osc(3, 0, 2)
|
|
617
|
+
* .modulate(noise().add(gradient(), -1), 1)
|
|
612
618
|
* ```
|
|
613
619
|
*/
|
|
614
|
-
modulate
|
|
620
|
+
modulate(source: ISynthSource, amount?: SynthParameterValue): this;
|
|
615
621
|
/**
|
|
616
622
|
* Modulate scale using another source.
|
|
617
623
|
* @param source - Modulation source
|
|
618
624
|
* @param multiple - Scale multiplier (default: 1.0)
|
|
619
625
|
* @param offset - Offset amount (default: 1.0)
|
|
620
626
|
*/
|
|
621
|
-
modulateScale
|
|
627
|
+
modulateScale(source: ISynthSource, multiple?: SynthParameterValue, offset?: SynthParameterValue): this;
|
|
622
628
|
/**
|
|
623
629
|
* Modulate rotation using another source.
|
|
624
630
|
* @param source - Modulation source
|
|
625
631
|
* @param multiple - Rotation multiplier (default: 1.0)
|
|
626
632
|
* @param offset - Offset amount (default: 0.0)
|
|
627
633
|
*/
|
|
628
|
-
modulateRotate
|
|
634
|
+
modulateRotate(source: ISynthSource, multiple?: SynthParameterValue, offset?: SynthParameterValue): this;
|
|
629
635
|
/**
|
|
630
636
|
* Modulate pixelation using another source.
|
|
631
637
|
* @param source - Modulation source
|
|
632
638
|
* @param multiple - Pixelation multiplier (default: 10.0)
|
|
633
639
|
* @param offset - Offset amount (default: 3.0)
|
|
640
|
+
*
|
|
641
|
+
* @example
|
|
642
|
+
* ```typescript
|
|
643
|
+
* noise(3).modulatePixelate(noise(1, 0).pixelate(8, 8), 1024, 8)
|
|
644
|
+
* ```
|
|
634
645
|
*/
|
|
635
|
-
modulatePixelate
|
|
646
|
+
modulatePixelate(source: ISynthSource, multiple?: SynthParameterValue, offset?: SynthParameterValue): this;
|
|
636
647
|
/**
|
|
637
648
|
* Modulate kaleidoscope using another source.
|
|
638
649
|
* @param source - Modulation source
|
|
639
650
|
* @param nSides - Number of sides (default: 4.0)
|
|
651
|
+
*
|
|
652
|
+
* @example
|
|
653
|
+
* ```typescript
|
|
654
|
+
* osc(2, 0.1, 2)
|
|
655
|
+
* .modulateKaleid(osc(16).kaleid(999), 1)
|
|
656
|
+
* ```
|
|
640
657
|
*/
|
|
641
|
-
modulateKaleid
|
|
658
|
+
modulateKaleid(source: ISynthSource, nSides?: SynthParameterValue): this;
|
|
642
659
|
/**
|
|
643
660
|
* Modulate X scroll using another source.
|
|
644
661
|
* @param source - Modulation source
|
|
645
662
|
* @param scrollX - X scroll amount (default: 0.5)
|
|
646
663
|
* @param speed - Scroll speed (default: 0.0)
|
|
647
664
|
*/
|
|
648
|
-
modulateScrollX
|
|
665
|
+
modulateScrollX(source: ISynthSource, scrollX?: SynthParameterValue, speed?: SynthParameterValue): this;
|
|
649
666
|
/**
|
|
650
667
|
* Modulate Y scroll using another source.
|
|
651
668
|
* @param source - Modulation source
|
|
652
669
|
* @param scrollY - Y scroll amount (default: 0.5)
|
|
653
670
|
* @param speed - Scroll speed (default: 0.0)
|
|
654
671
|
*/
|
|
655
|
-
modulateScrollY
|
|
672
|
+
modulateScrollY(source: ISynthSource, scrollY?: SynthParameterValue, speed?: SynthParameterValue): this;
|
|
656
673
|
/**
|
|
657
|
-
*
|
|
658
|
-
* @
|
|
659
|
-
* @param speed - Animation speed (default: 0.1)
|
|
660
|
-
* @param charCount - Number of different characters to use (default: 256)
|
|
661
|
-
*/
|
|
662
|
-
charNoise?: (scale?: SynthParameterValue, speed?: SynthParameterValue, charCount?: SynthParameterValue) => ISynthSource;
|
|
663
|
-
/**
|
|
664
|
-
* Generate character indices using oscillating sine waves.
|
|
665
|
-
* @param frequency - Frequency of the oscillation (default: 60.0)
|
|
666
|
-
* @param sync - Synchronization offset (default: 0.1)
|
|
667
|
-
* @param charCount - Number of different characters to use (default: 256)
|
|
668
|
-
*/
|
|
669
|
-
charOsc?: (frequency?: SynthParameterValue, sync?: SynthParameterValue, charCount?: SynthParameterValue) => ISynthSource;
|
|
670
|
-
/**
|
|
671
|
-
* Generate character indices using a gradient.
|
|
672
|
-
* @param charCount - Number of different characters to use (default: 256)
|
|
673
|
-
* @param direction - Gradient direction (default: 0.0)
|
|
674
|
-
*/
|
|
675
|
-
charGradient?: (charCount?: SynthParameterValue, direction?: SynthParameterValue) => ISynthSource;
|
|
676
|
-
/**
|
|
677
|
-
* Generate character indices using Voronoi (cellular) patterns.
|
|
678
|
-
* @param scale - Scale of Voronoi cells (default: 5.0)
|
|
679
|
-
* @param speed - Animation speed (default: 0.3)
|
|
680
|
-
* @param charCount - Number of different characters to use (default: 256)
|
|
674
|
+
* Add a transform to the chain.
|
|
675
|
+
* @ignore
|
|
681
676
|
*/
|
|
682
|
-
|
|
677
|
+
addTransform(name: string, userArgs: SynthParameterValue[]): this;
|
|
683
678
|
/**
|
|
684
|
-
*
|
|
685
|
-
* @
|
|
686
|
-
* @param innerChar - Character index for inside the shape (default: 0)
|
|
687
|
-
* @param outerChar - Character index for outside the shape (default: 1)
|
|
688
|
-
* @param radius - Radius of the shape (default: 0.3)
|
|
689
|
-
*/
|
|
690
|
-
charShape?: (sides?: SynthParameterValue, innerChar?: SynthParameterValue, outerChar?: SynthParameterValue, radius?: SynthParameterValue) => ISynthSource;
|
|
691
|
-
/**
|
|
692
|
-
* Generate a solid character index across the entire canvas.
|
|
693
|
-
* @param charIndex - Character index to use (default: 0)
|
|
694
|
-
*/
|
|
695
|
-
charSolid?: (charIndex?: SynthParameterValue) => ISynthSource;
|
|
696
|
-
/**
|
|
697
|
-
* Flip characters horizontally.
|
|
698
|
-
* @param toggle - Toggle flip (default: 1.0)
|
|
679
|
+
* Add a combine transform that references another source.
|
|
680
|
+
* @ignore
|
|
699
681
|
*/
|
|
700
|
-
|
|
682
|
+
addCombineTransform(name: string, source: ISynthSource, userArgs: SynthParameterValue[]): this;
|
|
701
683
|
/**
|
|
702
|
-
*
|
|
703
|
-
* @
|
|
704
|
-
*/
|
|
705
|
-
charFlipY?: (toggle?: SynthParameterValue) => ISynthSource;
|
|
706
|
-
/**
|
|
707
|
-
* Invert character indices.
|
|
708
|
-
* @param toggle - Toggle invert (default: 1.0)
|
|
709
|
-
*/
|
|
710
|
-
charInvert?: (toggle?: SynthParameterValue) => ISynthSource;
|
|
711
|
-
/**
|
|
712
|
-
* Rotate characters.
|
|
713
|
-
* @param angle - Rotation angle in radians (default: 0.0)
|
|
714
|
-
* @param speed - Rotation speed (default: 0.0)
|
|
684
|
+
* Add an external layer reference at the current transform index.
|
|
685
|
+
* @ignore
|
|
715
686
|
*/
|
|
716
|
-
|
|
687
|
+
addExternalLayerRef(ref: unknown): this;
|
|
717
688
|
}
|
|
718
689
|
//# sourceMappingURL=ISynthSource.d.ts.map
|