asciify-engine 1.0.97 → 1.0.99
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 +52 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/asciify-engine/SKILL.md +48 -3
package/package.json
CHANGED
|
@@ -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.
|
|
11
|
+
**Current version:** `1.0.99`
|
|
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.
|
|
39
|
+
npm install asciify-engine@1.0.99
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
## Mental Model
|
|
@@ -72,8 +72,48 @@ options: {
|
|
|
72
72
|
}
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
+
Crop from the sides the same way:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
options: {
|
|
79
|
+
sourceCrop: { left: 0.1, right: 0.1 },
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Use any side together:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
options: {
|
|
87
|
+
sourceCrop: { top: 0.08, right: 0.12, bottom: 0.22, left: 0.12 },
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
75
91
|
For centered crops, `sourceCrop: { height: 0.7 }` keeps 70% of the source and crops equally from top/bottom plus left/right as needed. Set `preserveAspect: false` only when an exact source window is more important than avoiding stretch. `sourceCrop` is opt-in; when omitted, the engine samples the full source exactly as older versions did.
|
|
76
92
|
|
|
93
|
+
Use top-level `asciifyVideo` layout options when the destination needs full-bleed framing. These affect the visible canvas only, not the sampled media:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
await asciifyVideo('/hero.mp4', canvas, {
|
|
97
|
+
fitTo: hero,
|
|
98
|
+
objectFit: 'cover',
|
|
99
|
+
objectPosition: 'center 62%',
|
|
100
|
+
scale: 1.06,
|
|
101
|
+
width: '100%',
|
|
102
|
+
height: '100%',
|
|
103
|
+
options: {
|
|
104
|
+
sourceCrop: { top: 0.08, bottom: 0.14 },
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Mental split:
|
|
110
|
+
|
|
111
|
+
- `sourceCrop` chooses the source window before ASCII conversion.
|
|
112
|
+
- `objectFit`, `objectPosition`, `scale`, `width`, and `height` place the rendered canvas in the page.
|
|
113
|
+
- Use `objectFit: 'cover'` for full-width/full-bleed heroes.
|
|
114
|
+
- Use `objectFit: 'contain'` for previews where the whole source should remain visible.
|
|
115
|
+
- Use `scale` for gentle overfill instead of CSS width hacks like `110vw`.
|
|
116
|
+
|
|
77
117
|
## Visual Target
|
|
78
118
|
|
|
79
119
|
Good ASCII media should feel intentional, not like a broken video filter.
|
|
@@ -123,6 +163,10 @@ Recommended starting point:
|
|
|
123
163
|
```ts
|
|
124
164
|
{
|
|
125
165
|
fitTo: hero,
|
|
166
|
+
objectFit: 'cover',
|
|
167
|
+
objectPosition: 'center bottom',
|
|
168
|
+
width: '100%',
|
|
169
|
+
height: '100%',
|
|
126
170
|
fontSize: 5,
|
|
127
171
|
fps: 60,
|
|
128
172
|
maxRenderDimension: 1280,
|
|
@@ -228,8 +272,9 @@ await asciifyVideo(video, canvas, {
|
|
|
228
272
|
|
|
229
273
|
- `sourceCrop` happens before ASCII sampling, so the subject is reframed without changing the canvas box.
|
|
230
274
|
- Default unit is `'percent'`; use values from `0` to `1`.
|
|
275
|
+
- Use `top`, `right`, `bottom`, and `left` for CSS-like side crops.
|
|
231
276
|
- Use `{ unit: 'pixel', x, y, width, height }` for exact media-pixel crops.
|
|
232
|
-
- Keep
|
|
277
|
+
- Keep `preserveAspect` enabled unless you intentionally want an exact source window that can stretch.
|
|
233
278
|
- For hero videos, crop the source first, then use small layout overlap only if the next section needs to tuck closer.
|
|
234
279
|
|
|
235
280
|
### Scroll-Scrub Performance Model
|