asciify-engine 4.6.0 → 4.8.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/README.md +31 -0
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{model-Tyu-NpVf.d.ts → model-CMKdRB30.d.ts} +76 -1
- package/dist/{model-BR3qK_NW.d.cts → model-fP9NdG-w.d.cts} +76 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.cts +168 -5
- package/dist/studio.d.ts +168 -5
- package/dist/studio.js +1 -1
- package/examples/layered-composition.ts +24 -0
- package/examples/studio-composition.ts +4 -7
- package/package.json +2 -1
- package/skills/asciify-engine/SKILL.md +6 -2
- package/skills/asciify-engine/agents/openai.yaml +2 -2
- package/skills/asciify-engine/references/layered-projects.md +89 -0
- package/skills/asciify-engine/references/project-integration.md +1 -0
- package/skills/asciify-engine/references/source-shaping.md +54 -0
- package/skills/asciify-engine/references/studio-workspace.md +5 -1
- package/skills/asciify-engine/references/upgrading.md +8 -0
package/README.md
CHANGED
|
@@ -580,3 +580,34 @@ const settings = player.settings; // detached snapshot for save/export
|
|
|
580
580
|
```
|
|
581
581
|
|
|
582
582
|
See [settings, normalization, processing order and performance guidance](skills/asciify-engine/references/studio-workspace.md#channel-curves-and-source-noise-46). Curves are local source controls, not another art-style alias or AI restoration.
|
|
583
|
+
|
|
584
|
+
### Ordered source shaping (4.7)
|
|
585
|
+
|
|
586
|
+
Combine up to eight source transformations before ASCII, dither or any Studio style: Twirl, Pinch, Spherize, Ripple, Zigzag, Shear, Smudge, Polar and Fragment. Edit strength, position and radius, plus direction/frequency where applicable. Reorder or disable stages without losing their settings; choose extended or transparent edges. Generate controls from `STUDIO_WARPS` and `MAX_STUDIO_WARPS`.
|
|
587
|
+
|
|
588
|
+
```ts
|
|
589
|
+
player.update({
|
|
590
|
+
warps: [{type:'sphere',amount:.3,radius:.7}, {type:'shear',amount:.15,angle:25}],
|
|
591
|
+
warpEdge:'clamp',
|
|
592
|
+
motion:{type:'parallax',amount:.5},
|
|
593
|
+
});
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
The stack is static shaping; motion and pointer hover remain independent. Coordinate maps are cached across video frames, and stills reuse shaped pixels during interaction. Empty stacks are free of additional pixel work. Defaults and root/core/hover behavior remain unchanged. Dither motion also gains alpha-correct interpolation at transparent edges. See [parameters, order, persistence/export and measured CPU tradeoffs](skills/asciify-engine/references/source-shaping.md).
|
|
597
|
+
|
|
598
|
+
### Layered projects (4.8)
|
|
599
|
+
|
|
600
|
+
Compose up to eight image, video, GIF or text layers with independent styles, motion, hover, placement, opacity and blend modes. `mountStudioProject` owns one playback loop and a shared cell/raster budget; hidden and unchanged layers skip work. Root/core/hover entry points remain unchanged.
|
|
601
|
+
|
|
602
|
+
```ts
|
|
603
|
+
import { mountStudioProject } from 'asciify-engine/studio';
|
|
604
|
+
const player = await mountStudioProject(canvas, { layers: [
|
|
605
|
+
{ id: 'photo', source: 'image', settings: { motion: { type: 'parallax' } } },
|
|
606
|
+
{ id: 'title', source: 'text', placement: { width: .8, height: .25 },
|
|
607
|
+
settings: { ink: '#b3ed82', hover: { effect: 'elastic' } } },
|
|
608
|
+
] }, { image: '/your-photo.webp', text: { text: 'HELLO', font: 'Small' } });
|
|
609
|
+
player.updateLayer('photo', { settings: { hover: { effect: 'water' } } });
|
|
610
|
+
// player.destroy() on unmount
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
`exportStudioProject` owns independent export media, so it does not disturb the live preview. Save layouts with `serializeStudioProject`, retain/rebind source assets separately, and restore with `parseStudioProject`. See the [layered-project guide](skills/asciify-engine/references/layered-projects.md) and [typed live/export example](examples/layered-composition.ts) for geometry, picking, ownership, cancellation and performance limits. This is an optional local composition API, not a claim of complete competitor-style or FPS parity.
|
package/dist/core.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as AsciiOptions, A as AsciiFrame, b as ArtStyle, H as HoverEffect } from './types-D38BMBRB.cjs';
|
|
2
2
|
export { c as AnimationStyle, d as AsciiCell, e as AsciiResult, C as ColorMode, D as DEFAULT_OPTIONS, f as HOVER_PRESETS, g as HoverPreset, h as HoverShape, P as PALETTE_THEMES, i as PaletteTheme, R as RenderMode, S as SourceType } from './types-D38BMBRB.cjs';
|
|
3
|
-
export { C as CHARACTER_SETS, g as STUDIO_STYLES,
|
|
3
|
+
export { C as CHARACTER_SETS, g as STUDIO_STYLES, n as StudioStyle } from './model-fP9NdG-w.cjs';
|
|
4
4
|
import './hover-catalog-BeIkNwhH.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as AsciiOptions, A as AsciiFrame, b as ArtStyle, H as HoverEffect } from './types-C05AfrjT.js';
|
|
2
2
|
export { c as AnimationStyle, d as AsciiCell, e as AsciiResult, C as ColorMode, D as DEFAULT_OPTIONS, f as HOVER_PRESETS, g as HoverPreset, h as HoverShape, P as PALETTE_THEMES, i as PaletteTheme, R as RenderMode, S as SourceType } from './types-C05AfrjT.js';
|
|
3
|
-
export { C as CHARACTER_SETS, g as STUDIO_STYLES,
|
|
3
|
+
export { C as CHARACTER_SETS, g as STUDIO_STYLES, n as StudioStyle } from './model-CMKdRB30.js';
|
|
4
4
|
import './hover-catalog-BeIkNwhH.js';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { c as AnimationStyle, b as ArtStyle, d as AsciiCell, A as AsciiFrame, a as AsciiOptions, e as AsciiResult, C as ColorMode, D as DEFAULT_OPTIONS, f as HOVER_PRESETS, H as HoverEffect, g as HoverPreset, h as HoverShape, P as PALETTE_THEMES, i as PaletteTheme, R as RenderMode, S as SourceType } from './types-D38BMBRB.cjs';
|
|
2
2
|
export { AsciiTextFrame, AsciifyLiveVideoOptions, AsciifySimpleOptions, AsciifyVideoOptions, BigTextOptions, CanvasBleed, CanvasObjectFit, CanvasRenderSizeInput, SnapshotOptions, TextBackgroundOptions, VideoScrollScrubOptions, WebcamOptions, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyLiveVideo, asciifyText, asciifyVideo, asciifyWebcam, buildTextFrame, captureSnapshot, clearAsciifyCaches, computeCanvasRenderSize, createVideoScrollScrub, gifToAsciiFrames, gifToAsciiTextFrames, imageToAsciiFrame, imageToAsciiTextFrame, renderFrameToCanvas, renderTextBackground, renderTextFrameToCanvas, renderTextToCanvas, snapshotAndDownload, videoToAsciiFrames, videoToAsciiTextFrames } from './core.cjs';
|
|
3
|
-
export { C as CHARACTER_SETS, g as STUDIO_STYLES,
|
|
3
|
+
export { C as CHARACTER_SETS, g as STUDIO_STYLES, n as StudioStyle } from './model-fP9NdG-w.cjs';
|
|
4
4
|
import './hover-catalog-BeIkNwhH.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { c as AnimationStyle, b as ArtStyle, d as AsciiCell, A as AsciiFrame, a as AsciiOptions, e as AsciiResult, C as ColorMode, D as DEFAULT_OPTIONS, f as HOVER_PRESETS, H as HoverEffect, g as HoverPreset, h as HoverShape, P as PALETTE_THEMES, i as PaletteTheme, R as RenderMode, S as SourceType } from './types-C05AfrjT.js';
|
|
2
2
|
export { AsciiTextFrame, AsciifyLiveVideoOptions, AsciifySimpleOptions, AsciifyVideoOptions, BigTextOptions, CanvasBleed, CanvasObjectFit, CanvasRenderSizeInput, SnapshotOptions, TextBackgroundOptions, VideoScrollScrubOptions, WebcamOptions, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyLiveVideo, asciifyText, asciifyVideo, asciifyWebcam, buildTextFrame, captureSnapshot, clearAsciifyCaches, computeCanvasRenderSize, createVideoScrollScrub, gifToAsciiFrames, gifToAsciiTextFrames, imageToAsciiFrame, imageToAsciiTextFrame, renderFrameToCanvas, renderTextBackground, renderTextFrameToCanvas, renderTextToCanvas, snapshotAndDownload, videoToAsciiFrames, videoToAsciiTextFrames } from './core.js';
|
|
3
|
-
export { C as CHARACTER_SETS, g as STUDIO_STYLES,
|
|
3
|
+
export { C as CHARACTER_SETS, g as STUDIO_STYLES, n as StudioStyle } from './model-CMKdRB30.js';
|
|
4
4
|
import './hover-catalog-BeIkNwhH.js';
|
|
@@ -84,6 +84,79 @@ declare function normalizeStudioCurves(input: unknown): StudioCurves;
|
|
|
84
84
|
*/
|
|
85
85
|
declare function createStudioCurveLookup(input: unknown): Uint8Array;
|
|
86
86
|
|
|
87
|
+
/** Source transformations, applied in list order before style conversion. */
|
|
88
|
+
declare const STUDIO_WARPS: readonly [{
|
|
89
|
+
readonly value: "twirl";
|
|
90
|
+
readonly label: "Twirl";
|
|
91
|
+
readonly description: "Rotate the center into a smooth spiral; the outer boundary stays fixed.";
|
|
92
|
+
readonly direction: false;
|
|
93
|
+
readonly frequency: false;
|
|
94
|
+
}, {
|
|
95
|
+
readonly value: "pinch";
|
|
96
|
+
readonly label: "Pinch";
|
|
97
|
+
readonly description: "Contract the center, or expand it with negative strength.";
|
|
98
|
+
readonly direction: false;
|
|
99
|
+
readonly frequency: false;
|
|
100
|
+
}, {
|
|
101
|
+
readonly value: "sphere";
|
|
102
|
+
readonly label: "Spherize";
|
|
103
|
+
readonly description: "Magnify a rounded lens through the source; negative strength recedes.";
|
|
104
|
+
readonly direction: false;
|
|
105
|
+
readonly frequency: false;
|
|
106
|
+
}, {
|
|
107
|
+
readonly value: "ripple";
|
|
108
|
+
readonly label: "Ripple";
|
|
109
|
+
readonly description: "Bend the image through concentric, soft-edged waves.";
|
|
110
|
+
readonly direction: false;
|
|
111
|
+
readonly frequency: true;
|
|
112
|
+
}, {
|
|
113
|
+
readonly value: "zigzag";
|
|
114
|
+
readonly label: "Zigzag";
|
|
115
|
+
readonly description: "Alternate the twist in sharp, concentric bands.";
|
|
116
|
+
readonly direction: false;
|
|
117
|
+
readonly frequency: true;
|
|
118
|
+
}, {
|
|
119
|
+
readonly value: "shear";
|
|
120
|
+
readonly label: "Shear";
|
|
121
|
+
readonly description: "Slant a region along an adjustable direction.";
|
|
122
|
+
readonly direction: true;
|
|
123
|
+
readonly frequency: false;
|
|
124
|
+
}, {
|
|
125
|
+
readonly value: "smudge";
|
|
126
|
+
readonly label: "Smudge";
|
|
127
|
+
readonly description: "Draw a soft region of the source along one direction.";
|
|
128
|
+
readonly direction: true;
|
|
129
|
+
readonly frequency: false;
|
|
130
|
+
}, {
|
|
131
|
+
readonly value: "polar";
|
|
132
|
+
readonly label: "Polar";
|
|
133
|
+
readonly description: "Unwrap a region into polar coordinates; negative strength wraps it.";
|
|
134
|
+
readonly direction: true;
|
|
135
|
+
readonly frequency: false;
|
|
136
|
+
}, {
|
|
137
|
+
readonly value: "fragment";
|
|
138
|
+
readonly label: "Fragment";
|
|
139
|
+
readonly description: "Offset small source tiles into a stable fractured texture.";
|
|
140
|
+
readonly direction: true;
|
|
141
|
+
readonly frequency: true;
|
|
142
|
+
}];
|
|
143
|
+
type StudioWarpType = typeof STUDIO_WARPS[number]['value'];
|
|
144
|
+
interface StudioWarp {
|
|
145
|
+
type: StudioWarpType;
|
|
146
|
+
enabled?: boolean;
|
|
147
|
+
amount?: number;
|
|
148
|
+
x?: number;
|
|
149
|
+
y?: number;
|
|
150
|
+
/** Radius as a fraction of the canvas's shorter side. */
|
|
151
|
+
radius?: number;
|
|
152
|
+
angle?: number;
|
|
153
|
+
frequency?: number;
|
|
154
|
+
}
|
|
155
|
+
type StudioWarpEdge = 'clamp' | 'transparent';
|
|
156
|
+
declare const MAX_STUDIO_WARPS = 8;
|
|
157
|
+
/** Unknown types are omitted, never silently converted into a different warp. */
|
|
158
|
+
declare function normalizeStudioWarps(input: unknown): Required<StudioWarp>[];
|
|
159
|
+
|
|
87
160
|
/** Serializable, media-independent editing state. No DOM work at import time. */
|
|
88
161
|
declare const STUDIO_STYLES: readonly ["ascii", "blocks", "braille", "dots", "lines", "cross", "diagonal", "diamond", "mixed", "pixel", "mosaic", "lego", "voxel", "disco", "dither", "hex", "led", "cmyk"];
|
|
89
162
|
type StudioStyle = (typeof STUDIO_STYLES)[number];
|
|
@@ -121,6 +194,8 @@ interface StudioSettings {
|
|
|
121
194
|
zoom: number;
|
|
122
195
|
rotation: number;
|
|
123
196
|
};
|
|
197
|
+
warps?: StudioWarp[];
|
|
198
|
+
warpEdge?: StudioWarpEdge;
|
|
124
199
|
backdrop: {
|
|
125
200
|
mode: "solid" | "transparent" | "source" | "blurred" | "gradient";
|
|
126
201
|
color: string;
|
|
@@ -225,4 +300,4 @@ declare function studioGrid(width: number, height: number, settings: Pick<Studio
|
|
|
225
300
|
limited: boolean;
|
|
226
301
|
};
|
|
227
302
|
|
|
228
|
-
export { BLEND_MODES as B, CHARACTER_SETS as C, DEFAULT_STUDIO_SETTINGS as D, type StudioSettings as S, type StudioInput as a, DITHER_ALGORITHMS as b, type DitherAlgorithm as c, STUDIO_CHARACTER_SETS as d, STUDIO_CURVE_CHANNELS as e, STUDIO_PALETTES as f, STUDIO_STYLES as g,
|
|
303
|
+
export { studioGrid as A, BLEND_MODES as B, CHARACTER_SETS as C, DEFAULT_STUDIO_SETTINGS as D, updateStudioSettings as E, MAX_STUDIO_WARPS as M, type StudioSettings as S, type StudioInput as a, DITHER_ALGORITHMS as b, type DitherAlgorithm as c, STUDIO_CHARACTER_SETS as d, STUDIO_CURVE_CHANNELS as e, STUDIO_PALETTES as f, STUDIO_STYLES as g, STUDIO_WARPS as h, type StudioCurveChannel as i, type StudioCurvePoint as j, type StudioCurves as k, type StudioLight as l, type StudioMask as m, type StudioStyle as n, type StudioWarp as o, type StudioWarpEdge as p, type StudioWarpType as q, createStudioCurveLookup as r, normalizeStudioCurve as s, normalizeStudioCurves as t, normalizeStudioSettings as u, normalizeStudioWarps as v, parseStudioSettings as w, serializeStudioSettings as x, studioCrop as y, studioDimensions as z };
|
|
@@ -84,6 +84,79 @@ declare function normalizeStudioCurves(input: unknown): StudioCurves;
|
|
|
84
84
|
*/
|
|
85
85
|
declare function createStudioCurveLookup(input: unknown): Uint8Array;
|
|
86
86
|
|
|
87
|
+
/** Source transformations, applied in list order before style conversion. */
|
|
88
|
+
declare const STUDIO_WARPS: readonly [{
|
|
89
|
+
readonly value: "twirl";
|
|
90
|
+
readonly label: "Twirl";
|
|
91
|
+
readonly description: "Rotate the center into a smooth spiral; the outer boundary stays fixed.";
|
|
92
|
+
readonly direction: false;
|
|
93
|
+
readonly frequency: false;
|
|
94
|
+
}, {
|
|
95
|
+
readonly value: "pinch";
|
|
96
|
+
readonly label: "Pinch";
|
|
97
|
+
readonly description: "Contract the center, or expand it with negative strength.";
|
|
98
|
+
readonly direction: false;
|
|
99
|
+
readonly frequency: false;
|
|
100
|
+
}, {
|
|
101
|
+
readonly value: "sphere";
|
|
102
|
+
readonly label: "Spherize";
|
|
103
|
+
readonly description: "Magnify a rounded lens through the source; negative strength recedes.";
|
|
104
|
+
readonly direction: false;
|
|
105
|
+
readonly frequency: false;
|
|
106
|
+
}, {
|
|
107
|
+
readonly value: "ripple";
|
|
108
|
+
readonly label: "Ripple";
|
|
109
|
+
readonly description: "Bend the image through concentric, soft-edged waves.";
|
|
110
|
+
readonly direction: false;
|
|
111
|
+
readonly frequency: true;
|
|
112
|
+
}, {
|
|
113
|
+
readonly value: "zigzag";
|
|
114
|
+
readonly label: "Zigzag";
|
|
115
|
+
readonly description: "Alternate the twist in sharp, concentric bands.";
|
|
116
|
+
readonly direction: false;
|
|
117
|
+
readonly frequency: true;
|
|
118
|
+
}, {
|
|
119
|
+
readonly value: "shear";
|
|
120
|
+
readonly label: "Shear";
|
|
121
|
+
readonly description: "Slant a region along an adjustable direction.";
|
|
122
|
+
readonly direction: true;
|
|
123
|
+
readonly frequency: false;
|
|
124
|
+
}, {
|
|
125
|
+
readonly value: "smudge";
|
|
126
|
+
readonly label: "Smudge";
|
|
127
|
+
readonly description: "Draw a soft region of the source along one direction.";
|
|
128
|
+
readonly direction: true;
|
|
129
|
+
readonly frequency: false;
|
|
130
|
+
}, {
|
|
131
|
+
readonly value: "polar";
|
|
132
|
+
readonly label: "Polar";
|
|
133
|
+
readonly description: "Unwrap a region into polar coordinates; negative strength wraps it.";
|
|
134
|
+
readonly direction: true;
|
|
135
|
+
readonly frequency: false;
|
|
136
|
+
}, {
|
|
137
|
+
readonly value: "fragment";
|
|
138
|
+
readonly label: "Fragment";
|
|
139
|
+
readonly description: "Offset small source tiles into a stable fractured texture.";
|
|
140
|
+
readonly direction: true;
|
|
141
|
+
readonly frequency: true;
|
|
142
|
+
}];
|
|
143
|
+
type StudioWarpType = typeof STUDIO_WARPS[number]['value'];
|
|
144
|
+
interface StudioWarp {
|
|
145
|
+
type: StudioWarpType;
|
|
146
|
+
enabled?: boolean;
|
|
147
|
+
amount?: number;
|
|
148
|
+
x?: number;
|
|
149
|
+
y?: number;
|
|
150
|
+
/** Radius as a fraction of the canvas's shorter side. */
|
|
151
|
+
radius?: number;
|
|
152
|
+
angle?: number;
|
|
153
|
+
frequency?: number;
|
|
154
|
+
}
|
|
155
|
+
type StudioWarpEdge = 'clamp' | 'transparent';
|
|
156
|
+
declare const MAX_STUDIO_WARPS = 8;
|
|
157
|
+
/** Unknown types are omitted, never silently converted into a different warp. */
|
|
158
|
+
declare function normalizeStudioWarps(input: unknown): Required<StudioWarp>[];
|
|
159
|
+
|
|
87
160
|
/** Serializable, media-independent editing state. No DOM work at import time. */
|
|
88
161
|
declare const STUDIO_STYLES: readonly ["ascii", "blocks", "braille", "dots", "lines", "cross", "diagonal", "diamond", "mixed", "pixel", "mosaic", "lego", "voxel", "disco", "dither", "hex", "led", "cmyk"];
|
|
89
162
|
type StudioStyle = (typeof STUDIO_STYLES)[number];
|
|
@@ -121,6 +194,8 @@ interface StudioSettings {
|
|
|
121
194
|
zoom: number;
|
|
122
195
|
rotation: number;
|
|
123
196
|
};
|
|
197
|
+
warps?: StudioWarp[];
|
|
198
|
+
warpEdge?: StudioWarpEdge;
|
|
124
199
|
backdrop: {
|
|
125
200
|
mode: "solid" | "transparent" | "source" | "blurred" | "gradient";
|
|
126
201
|
color: string;
|
|
@@ -225,4 +300,4 @@ declare function studioGrid(width: number, height: number, settings: Pick<Studio
|
|
|
225
300
|
limited: boolean;
|
|
226
301
|
};
|
|
227
302
|
|
|
228
|
-
export { BLEND_MODES as B, CHARACTER_SETS as C, DEFAULT_STUDIO_SETTINGS as D, type StudioSettings as S, type StudioInput as a, DITHER_ALGORITHMS as b, type DitherAlgorithm as c, STUDIO_CHARACTER_SETS as d, STUDIO_CURVE_CHANNELS as e, STUDIO_PALETTES as f, STUDIO_STYLES as g,
|
|
303
|
+
export { studioGrid as A, BLEND_MODES as B, CHARACTER_SETS as C, DEFAULT_STUDIO_SETTINGS as D, updateStudioSettings as E, MAX_STUDIO_WARPS as M, type StudioSettings as S, type StudioInput as a, DITHER_ALGORITHMS as b, type DitherAlgorithm as c, STUDIO_CHARACTER_SETS as d, STUDIO_CURVE_CHANNELS as e, STUDIO_PALETTES as f, STUDIO_STYLES as g, STUDIO_WARPS as h, type StudioCurveChannel as i, type StudioCurvePoint as j, type StudioCurves as k, type StudioLight as l, type StudioMask as m, type StudioStyle as n, type StudioWarp as o, type StudioWarpEdge as p, type StudioWarpType as q, createStudioCurveLookup as r, normalizeStudioCurve as s, normalizeStudioCurves as t, normalizeStudioSettings as u, normalizeStudioWarps as v, parseStudioSettings as w, serializeStudioSettings as x, studioCrop as y, studioDimensions as z };
|