asciify-engine 1.0.110 → 1.0.112

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asciify-engine",
3
- "version": "1.0.110",
3
+ "version": "1.0.112",
4
4
  "description": "Framework-agnostic ASCII art engine. Convert images, videos, and GIFs into ASCII art rendered on canvas.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -8,7 +8,7 @@ description: Convert images, videos, GIFs, webcam streams, text, and animated ba
8
8
  Use this skill for the `asciify-engine` npm package.
9
9
 
10
10
  **Package:** `asciify-engine`
11
- **Current version:** `1.0.109`
11
+ **Current version:** `1.0.112`
12
12
  **Playground:** https://asciify.org
13
13
  **GitHub:** https://github.com/ayangabryl/asciify-engine
14
14
 
@@ -36,7 +36,7 @@ npm install asciify-engine
36
36
  For existing apps, install the latest tested version:
37
37
 
38
38
  ```bash
39
- npm install asciify-engine@1.0.109
39
+ npm install asciify-engine@1.0.112
40
40
  ```
41
41
 
42
42
  ## Mental Model
@@ -95,16 +95,29 @@ When `sourceCrop` and `chromaKey` are both enabled for video, `asciifyVideo` doe
95
95
  Use `chromaKeyTrimPadding: 0` for edge-tight marketing heroes. Leave the default `0.002` when preserving a tiny safety margin matters more than touching the exact viewport edge.
96
96
  If the canvas is full width but the visible keyed subject still feels short, raise `chromaKeyTrimLuminanceThreshold` slightly, usually `6–16`, so invisible edge noise is not counted as foreground.
97
97
 
98
+ For scroll-scrubbed hero footage where the foreground moves and a single range crop still leaves one frame short on the edge, use per-frame trim:
99
+
100
+ ```ts
101
+ options: {
102
+ chromaKey: true,
103
+ sourceCrop: { top: 0.08, bottom: 0.16 },
104
+ chromaKeyTrimMode: 'frame',
105
+ chromaKeyTrimPadding: 0,
106
+ }
107
+ ```
108
+
109
+ `chromaKeyTrimMode: 'frame'` remeasures the visible keyed foreground on each rendered frame and expands that crop back to the render aspect, so it avoids stretching while keeping moving subjects visually edge-tight. Use it for dense scrubbed marketing hero media; keep the default `'range'` for normal video when stable framing matters more.
110
+
98
111
  Use top-level `asciifyVideo` layout options when the destination needs full-bleed framing. These affect the visible canvas only, not the sampled media:
99
112
 
100
113
  ```ts
101
114
  await asciifyVideo('/hero.mp4', canvas, {
102
115
  fitTo: hero,
103
- objectFit: 'cover',
104
- objectPosition: 'center 62%',
105
- scale: 1.06,
106
- width: '100%',
116
+ objectFit: 'contain',
117
+ objectPosition: 'center bottom',
118
+ width: '100vw',
107
119
  height: '100%',
120
+ bleed: { x: '2vw' },
108
121
  options: {
109
122
  sourceCrop: { top: 0.08, bottom: 0.14 },
110
123
  },
@@ -115,10 +128,11 @@ Mental split:
115
128
 
116
129
  - `sourceCrop` chooses the source window before ASCII conversion.
117
130
  - CSS-like insets change the crop aspect naturally; the engine keeps ASCII proportions intact.
118
- - `objectFit`, `objectPosition`, `scale`, `width`, and `height` place the rendered canvas in the page.
131
+ - `objectFit`, `objectPosition`, `scale`, `width`, `height`, and `bleed` place the rendered canvas in the page.
119
132
  - Use `objectFit: 'cover'` for full-width/full-bleed heroes and backgrounds.
120
133
  - Use `objectFit: 'contain'` for previews where the whole source should remain visible.
121
- - Use `scale` for gentle overfill instead of CSS width hacks like `110vw`.
134
+ - Use `bleed: { x: '2vw' }` for edge-tight ASCII heroes where the source is correct but glyph side bearings or cell quantization leave a thin visual edge gap. This is preferable to app CSS hacks like `width: 104vw`.
135
+ - Use `scale` only when you intentionally want the whole ASCII canvas visually larger.
122
136
 
123
137
  ## Visual Target
124
138
 
@@ -169,10 +183,11 @@ Recommended starting point:
169
183
  ```ts
170
184
  {
171
185
  fitTo: hero,
172
- objectFit: 'cover',
186
+ objectFit: 'contain',
173
187
  objectPosition: 'center bottom',
174
- width: '100%',
188
+ width: '100vw',
175
189
  height: '100%',
190
+ bleed: { x: '2vw' },
176
191
  fontSize: 5,
177
192
  fps: 60,
178
193
  maxRenderDimension: 1280,