@jyiro/ascii-script 0.1.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 +21 -0
- package/README.md +669 -0
- package/dist/ascii-art-DCOQt4Se.js +285 -0
- package/dist/ascii-script.js +892 -0
- package/dist/procedural-BY9bCgT3.js +66 -0
- package/dist/text-CKJIlRsq.js +262 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jyiro
|
|
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
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
# ASCII-SCRIPT
|
|
2
|
+
|
|
3
|
+
> Micro-librería JavaScript para renderizado y animación de arte ASCII en el DOM
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://bundlephobia.com)
|
|
7
|
+
[](https://www.npmjs.com/package/@jyiro/ascii-script)
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
**[English](#english-version) | Español**
|
|
12
|
+
|
|
13
|
+
Librería ligera e independiente de frameworks para crear impresionantes animaciones de arte ASCII en el navegador.
|
|
14
|
+
|
|
15
|
+
## Características
|
|
16
|
+
|
|
17
|
+
- **Efectos Variados** - Wave, color-cycle, glitch, scramble, typewriter, matrix rain y más
|
|
18
|
+
- **Presets Listos** - Combinaciones preconfiguradas de efectos (hologram, rainbow, terminal, decrypt)
|
|
19
|
+
- **Bundle Minúsculo** - ~5kb core + efectos cargados bajo demanda (3-5kb cada uno)
|
|
20
|
+
- **Rendimiento 60fps** - Aceleración GPU vía transformaciones CSS, fallback canvas para arte grande
|
|
21
|
+
- **Agnóstico de Framework** - JavaScript puro, funciona con React, Vue, Svelte o vanilla
|
|
22
|
+
- **Auto-Detección** - Detecta y formatea automáticamente arte ASCII multi-línea
|
|
23
|
+
- **Extensible** - Sistema de plugins para efectos personalizados
|
|
24
|
+
- **API Intuitiva** - Métodos encadenables y configuración sencilla
|
|
25
|
+
- **Responsive** - Se adapta a diferentes tamaños de pantalla
|
|
26
|
+
- **Zero Dependencies** - Sin dependencias externas
|
|
27
|
+
|
|
28
|
+
## Inicio Rápido
|
|
29
|
+
|
|
30
|
+
### Instalación
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @jyiro/ascii-script
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
O usando CDN:
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<script type="module">
|
|
40
|
+
import { create } from 'https://unpkg.com/@jyiro/ascii-script';
|
|
41
|
+
</script>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Uso Básico
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
import { create } from '@jyiro/ascii-script';
|
|
48
|
+
|
|
49
|
+
// Inicializar motor
|
|
50
|
+
const ascii = create();
|
|
51
|
+
|
|
52
|
+
// Crear instancia de arte ASCII
|
|
53
|
+
const logo = ascii.createArt('#my-logo');
|
|
54
|
+
|
|
55
|
+
// Aplicar efectos
|
|
56
|
+
await logo.wave({ amplitude: 3 });
|
|
57
|
+
await logo.colorCycle();
|
|
58
|
+
|
|
59
|
+
// Iniciar animación
|
|
60
|
+
logo.play();
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### HTML
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<pre id="my-logo">
|
|
67
|
+
█████╗ ███████╗ ██████╗██╗██╗
|
|
68
|
+
██╔══██╗██╔════╝██╔════╝██║██║
|
|
69
|
+
███████║███████╗██║ ██║██║
|
|
70
|
+
██╔══██║╚════██║██║ ██║██║
|
|
71
|
+
██║ ██║███████║╚██████╗██║██║
|
|
72
|
+
╚═╝ ╚═╝╚══════╝ ╚═════╝╚═╝╚═╝
|
|
73
|
+
</pre>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Efectos Disponibles
|
|
77
|
+
|
|
78
|
+
### Efectos para Arte ASCII
|
|
79
|
+
|
|
80
|
+
Perfectos para logos y banners ASCII estáticos:
|
|
81
|
+
|
|
82
|
+
- **Wave** - Desplazamiento en onda sinusoidal por línea
|
|
83
|
+
- **Color Cycle** - Rotación de color HSL tipo arcoíris
|
|
84
|
+
- **Pulse** - Animación de escala respiratoria
|
|
85
|
+
- **Perspective** - Transformaciones CSS 3D
|
|
86
|
+
- **Color Gradient** - Degradados de color suaves
|
|
87
|
+
|
|
88
|
+
### Efectos de Animación de Texto
|
|
89
|
+
|
|
90
|
+
Para texto dinámico:
|
|
91
|
+
|
|
92
|
+
- **Scramble** - Reemplazo aleatorio de caracteres con revelado progresivo
|
|
93
|
+
- **Reveal** - Revelación secuencial de caracteres
|
|
94
|
+
- **Glitch** - Corrupción digital y desplazamiento
|
|
95
|
+
- **Typewriter** - Efecto de escritura de terminal
|
|
96
|
+
- **Matrix Rain** - Caracteres cayendo estilo Matrix
|
|
97
|
+
|
|
98
|
+
### Efectos Procedurales
|
|
99
|
+
|
|
100
|
+
Fondos basados en canvas:
|
|
101
|
+
|
|
102
|
+
- **Noise** - Generación de ruido tipo Perlin
|
|
103
|
+
- **Scanlines** - Efecto de monitor CRT
|
|
104
|
+
- **Particles** - Partículas de caracteres ASCII
|
|
105
|
+
|
|
106
|
+
## Presets
|
|
107
|
+
|
|
108
|
+
Combinaciones preconfiguradas de efectos para uso rápido:
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
// Efecto holográfico (glitch + pulse)
|
|
112
|
+
await logo.preset('hologram');
|
|
113
|
+
|
|
114
|
+
// Efecto Matrix (matrix rain + scanlines)
|
|
115
|
+
await text.preset('matrix');
|
|
116
|
+
|
|
117
|
+
// Animación de desencriptado (scramble → reveal)
|
|
118
|
+
await text.preset('decrypt');
|
|
119
|
+
|
|
120
|
+
// Onda arcoíris (wave + color cycle)
|
|
121
|
+
await logo.preset('rainbow');
|
|
122
|
+
|
|
123
|
+
// Terminal retro (typewriter + scanlines)
|
|
124
|
+
await text.preset('terminal');
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Ejemplos
|
|
128
|
+
|
|
129
|
+
### Ejecutar Ejemplos en Vivo
|
|
130
|
+
|
|
131
|
+
Para ver los ejemplos interactivos en tu navegador:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# 1. Clonar o navegar al proyecto
|
|
135
|
+
cd ascii-script
|
|
136
|
+
|
|
137
|
+
# 2. Instalar dependencias
|
|
138
|
+
npm install
|
|
139
|
+
|
|
140
|
+
# 3. Iniciar servidor de desarrollo
|
|
141
|
+
npm run dev
|
|
142
|
+
|
|
143
|
+
# 4. Abrir en el navegador
|
|
144
|
+
# El servidor te mostrará la URL (generalmente http://localhost:5173)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Ejemplos Disponibles:**
|
|
148
|
+
|
|
149
|
+
- **Enhanced Terminal** - `examples/enhanced.html`
|
|
150
|
+
- Terminal interactivo completo con todos los efectos
|
|
151
|
+
- Controles en tiempo real
|
|
152
|
+
- Showcase de todos los presets
|
|
153
|
+
|
|
154
|
+
### Ejemplos de Código
|
|
155
|
+
|
|
156
|
+
#### Logo Animado
|
|
157
|
+
|
|
158
|
+
```javascript
|
|
159
|
+
const ascii = create();
|
|
160
|
+
const logo = ascii.createArt('#logo');
|
|
161
|
+
|
|
162
|
+
await logo.preset('rainbow');
|
|
163
|
+
logo.play();
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### Efecto Typewriter
|
|
167
|
+
|
|
168
|
+
```javascript
|
|
169
|
+
const text = ascii.createArt('#greeting');
|
|
170
|
+
|
|
171
|
+
await text.typewriter({ speed: 80 });
|
|
172
|
+
text.play();
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
#### Fondo Procedural
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
const bg = ascii.createBackground('#bg', {
|
|
179
|
+
cols: 80,
|
|
180
|
+
rows: 40,
|
|
181
|
+
charset: ' .:-=+*#%@'
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
bg.play();
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Cadena de Efectos Personalizada
|
|
188
|
+
|
|
189
|
+
```javascript
|
|
190
|
+
await art
|
|
191
|
+
.scramble({ duration: 1000 })
|
|
192
|
+
.then(() => art.reveal({ duration: 1500 }))
|
|
193
|
+
.then(() => art.wave());
|
|
194
|
+
|
|
195
|
+
art.play();
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Efecto Matrix Completo
|
|
199
|
+
|
|
200
|
+
```javascript
|
|
201
|
+
const ascii = create();
|
|
202
|
+
|
|
203
|
+
// Fondo con scanlines
|
|
204
|
+
const bg = ascii.createBackground('#bg', {
|
|
205
|
+
cols: 100,
|
|
206
|
+
rows: 40
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Texto con matrix rain
|
|
210
|
+
const text = ascii.createArt('#matrix-text');
|
|
211
|
+
await text.preset('matrix');
|
|
212
|
+
|
|
213
|
+
// Reproducir ambos
|
|
214
|
+
bg.play();
|
|
215
|
+
text.play();
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Animación Secuencial
|
|
219
|
+
|
|
220
|
+
```javascript
|
|
221
|
+
const ascii = create();
|
|
222
|
+
const logo = ascii.createArt('#logo');
|
|
223
|
+
|
|
224
|
+
// Secuencia de efectos
|
|
225
|
+
async function animate() {
|
|
226
|
+
await logo.scramble({ duration: 800 });
|
|
227
|
+
await logo.reveal({ duration: 1200 });
|
|
228
|
+
await logo.colorCycle();
|
|
229
|
+
logo.play();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
animate();
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Documentación
|
|
236
|
+
|
|
237
|
+
- [Referencia API Completa](docs/api.md) - Documentación detallada de todas las APIs y métodos
|
|
238
|
+
- **Ejemplos en Vivo** - Ejecuta `npm run dev` y abre `examples/enhanced.html` - Terminal interactivo completo
|
|
239
|
+
- Guía de Efectos Personalizados - Ver sección "Uso Avanzado" en [docs/api.md](docs/api.md)
|
|
240
|
+
|
|
241
|
+
## Desarrollo
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Instalar dependencias
|
|
245
|
+
npm install
|
|
246
|
+
|
|
247
|
+
# Servidor de desarrollo
|
|
248
|
+
npm run dev
|
|
249
|
+
|
|
250
|
+
# Build de producción
|
|
251
|
+
npm run build
|
|
252
|
+
|
|
253
|
+
# Ejecutar tests
|
|
254
|
+
npm test
|
|
255
|
+
|
|
256
|
+
# Tests con UI
|
|
257
|
+
npm run test:ui
|
|
258
|
+
|
|
259
|
+
# Linter
|
|
260
|
+
npm run lint
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Casos de Uso
|
|
264
|
+
|
|
265
|
+
- **Landing Pages** - Headers con arte ASCII llamativo
|
|
266
|
+
- **Portafolios de Desarrolladores** - Efectos estilo terminal
|
|
267
|
+
- **Sitios Retro** - Estética años 80/90
|
|
268
|
+
- **Proyectos Creativos** - Arte ASCII generativo
|
|
269
|
+
- **Juegos** - Interfaces de juegos retro
|
|
270
|
+
- **Dashboards** - Monitores estilo terminal
|
|
271
|
+
- **Presentaciones** - Slides con animaciones únicas
|
|
272
|
+
- **Arte Interactivo** - Instalaciones web creativas
|
|
273
|
+
|
|
274
|
+
## Compatibilidad de Navegadores
|
|
275
|
+
|
|
276
|
+
| Navegador | Versión Mínima |
|
|
277
|
+
|-----------|---------------|
|
|
278
|
+
| Chrome | 90+ |
|
|
279
|
+
| Firefox | 88+ |
|
|
280
|
+
| Safari | 14+ |
|
|
281
|
+
| Edge | 90+ |
|
|
282
|
+
|
|
283
|
+
Requiere soporte ES2022+.
|
|
284
|
+
|
|
285
|
+
## Arquitectura
|
|
286
|
+
|
|
287
|
+
```
|
|
288
|
+
ascii-script/
|
|
289
|
+
├── src/
|
|
290
|
+
│ ├── index.js # Punto de entrada principal
|
|
291
|
+
│ ├── presets.js # Presets preconfigurados
|
|
292
|
+
│ ├── core/ # Motor central
|
|
293
|
+
│ │ ├── engine.js # Loop de animación
|
|
294
|
+
│ │ ├── registry.js # Registro de efectos
|
|
295
|
+
│ │ └── timing.js # Sistema de timing
|
|
296
|
+
│ ├── effects/ # Efectos disponibles
|
|
297
|
+
│ │ ├── base-effect.js # Clase base para efectos
|
|
298
|
+
│ │ ├── ascii-art/ # Efectos para arte ASCII
|
|
299
|
+
│ │ ├── procedural/ # Efectos procedurales
|
|
300
|
+
│ │ └── text/ # Efectos de texto
|
|
301
|
+
│ └── render/ # Sistemas de renderizado
|
|
302
|
+
│ ├── base-instance.js
|
|
303
|
+
│ ├── canvas-grid.js
|
|
304
|
+
│ └── text-block.js
|
|
305
|
+
├── examples/ # Ejemplos de uso
|
|
306
|
+
├── tests/ # Suite de tests
|
|
307
|
+
└── docs/ # Documentación
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## Rendimiento
|
|
311
|
+
|
|
312
|
+
- **Bundle core**: ~5kb gzipped
|
|
313
|
+
- **Efectos**: 3-5kb cada uno (carga bajo demanda)
|
|
314
|
+
- **Target**: Renderizado a 60fps
|
|
315
|
+
- **Aceleración GPU**: Vía transformaciones CSS
|
|
316
|
+
- **Fallback automático**: Canvas para arte grande (>100 líneas)
|
|
317
|
+
- **Tree-shaking**: Importa solo lo que uses
|
|
318
|
+
|
|
319
|
+
## Licencia
|
|
320
|
+
|
|
321
|
+
MIT © 2026
|
|
322
|
+
|
|
323
|
+
## Contribuir
|
|
324
|
+
|
|
325
|
+
¡Las contribuciones son bienvenidas! Por favor:
|
|
326
|
+
|
|
327
|
+
1. Fork el repositorio
|
|
328
|
+
2. Crea una rama para tu feature (`git checkout -b feature/AmazingFeature`)
|
|
329
|
+
3. Commit tus cambios (`git commit -m 'Add: AmazingFeature'`)
|
|
330
|
+
4. Push a la rama (`git push origin feature/AmazingFeature`)
|
|
331
|
+
5. Abre un Pull Request
|
|
332
|
+
|
|
333
|
+
## Créditos
|
|
334
|
+
|
|
335
|
+
Creado para la comunidad de arte ASCII.
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
<a name="english-version"></a>
|
|
340
|
+
|
|
341
|
+
# ASCII-SCRIPT
|
|
342
|
+
|
|
343
|
+
> Lightweight JavaScript library for ASCII art rendering and animation in the DOM
|
|
344
|
+
|
|
345
|
+
**English | [Español](#ascii-script)**
|
|
346
|
+
|
|
347
|
+
Framework-independent library for creating stunning ASCII art animations in the browser.
|
|
348
|
+
|
|
349
|
+
## Features
|
|
350
|
+
|
|
351
|
+
- **Rich Effects** - Wave, color-cycle, glitch, scramble, typewriter, matrix rain, and more
|
|
352
|
+
- **Ready-to-use Presets** - Pre-configured effect combinations (hologram, rainbow, terminal, decrypt)
|
|
353
|
+
- **Tiny Bundle** - ~5kb core + lazy-loaded effects (3-5kb each)
|
|
354
|
+
- **60fps Performance** - GPU-accelerated via CSS transforms, canvas fallback for large art
|
|
355
|
+
- **Framework-Agnostic** - Pure JavaScript, works with React, Vue, Svelte, or vanilla
|
|
356
|
+
- **Auto-Detection** - Automatically detects and formats multi-line ASCII art
|
|
357
|
+
- **Extensible** - Plugin system for custom effects
|
|
358
|
+
- **Intuitive API** - Chainable methods and simple configuration
|
|
359
|
+
- **Responsive** - Adapts to different screen sizes
|
|
360
|
+
- **Zero Dependencies** - No external dependencies
|
|
361
|
+
|
|
362
|
+
## Quick Start
|
|
363
|
+
|
|
364
|
+
### Installation
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
npm install ascii-script
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Or using CDN:
|
|
371
|
+
|
|
372
|
+
```html
|
|
373
|
+
<script type="module">
|
|
374
|
+
import { create } from 'https://unpkg.com/ascii-script';
|
|
375
|
+
</script>
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Basic Usage
|
|
379
|
+
|
|
380
|
+
```javascript
|
|
381
|
+
import { create } from '@jyiro/ascii-script';
|
|
382
|
+
|
|
383
|
+
// Initialize engine
|
|
384
|
+
const ascii = create();
|
|
385
|
+
|
|
386
|
+
// Create ASCII art instance
|
|
387
|
+
const logo = ascii.createArt('#my-logo');
|
|
388
|
+
|
|
389
|
+
// Apply effects
|
|
390
|
+
await logo.wave({ amplitude: 3 });
|
|
391
|
+
await logo.colorCycle();
|
|
392
|
+
|
|
393
|
+
// Start animation
|
|
394
|
+
logo.play();
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### HTML
|
|
398
|
+
|
|
399
|
+
```html
|
|
400
|
+
<pre id="my-logo">
|
|
401
|
+
█████╗ ███████╗ ██████╗██╗██╗
|
|
402
|
+
██╔══██╗██╔════╝██╔════╝██║██║
|
|
403
|
+
███████║███████╗██║ ██║██║
|
|
404
|
+
██╔══██║╚════██║██║ ██║██║
|
|
405
|
+
██║ ██║███████║╚██████╗██║██║
|
|
406
|
+
╚═╝ ╚═╝╚══════╝ ╚═════╝╚═╝╚═╝
|
|
407
|
+
</pre>
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
## Available Effects
|
|
411
|
+
|
|
412
|
+
### ASCII Art Effects
|
|
413
|
+
|
|
414
|
+
Perfect for static ASCII art logos and banners:
|
|
415
|
+
|
|
416
|
+
- **Wave** - Sine wave displacement per line
|
|
417
|
+
- **Color Cycle** - Rainbow HSL color rotation
|
|
418
|
+
- **Pulse** - Breathing scale animation
|
|
419
|
+
- **Perspective** - 3D CSS transforms
|
|
420
|
+
- **Color Gradient** - Smooth color gradients
|
|
421
|
+
|
|
422
|
+
### Text Animation Effects
|
|
423
|
+
|
|
424
|
+
For dynamic text:
|
|
425
|
+
|
|
426
|
+
- **Scramble** - Random character replacement with progressive reveal
|
|
427
|
+
- **Reveal** - Sequential character unveiling
|
|
428
|
+
- **Glitch** - Digital corruption and offset
|
|
429
|
+
- **Typewriter** - Terminal typing effect
|
|
430
|
+
- **Matrix Rain** - Matrix-style falling characters
|
|
431
|
+
|
|
432
|
+
### Procedural Effects
|
|
433
|
+
|
|
434
|
+
Canvas-based backgrounds:
|
|
435
|
+
|
|
436
|
+
- **Noise** - Perlin-like noise generation
|
|
437
|
+
- **Scanlines** - CRT monitor effect
|
|
438
|
+
- **Particles** - ASCII character particles
|
|
439
|
+
|
|
440
|
+
## Presets
|
|
441
|
+
|
|
442
|
+
Pre-configured effect combinations for quick use:
|
|
443
|
+
|
|
444
|
+
```javascript
|
|
445
|
+
// Hologram effect (glitch + pulse)
|
|
446
|
+
await logo.preset('hologram');
|
|
447
|
+
|
|
448
|
+
// Matrix effect (matrix rain + scanlines)
|
|
449
|
+
await text.preset('matrix');
|
|
450
|
+
|
|
451
|
+
// Decrypt animation (scramble → reveal)
|
|
452
|
+
await text.preset('decrypt');
|
|
453
|
+
|
|
454
|
+
// Rainbow wave (wave + color cycle)
|
|
455
|
+
await logo.preset('rainbow');
|
|
456
|
+
|
|
457
|
+
// Retro terminal (typewriter + scanlines)
|
|
458
|
+
await text.preset('terminal');
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
## Examples
|
|
462
|
+
|
|
463
|
+
### Run Live Examples
|
|
464
|
+
|
|
465
|
+
To view interactive examples in your browser:
|
|
466
|
+
|
|
467
|
+
```bash
|
|
468
|
+
# 1. Clone or navigate to the project
|
|
469
|
+
cd ascii-script
|
|
470
|
+
|
|
471
|
+
# 2. Install dependencies
|
|
472
|
+
npm install
|
|
473
|
+
|
|
474
|
+
# 3. Start development server
|
|
475
|
+
npm run dev
|
|
476
|
+
|
|
477
|
+
# 4. Open in browser
|
|
478
|
+
# The server will show you the URL (usually http://localhost:5173)
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
**Available Examples:**
|
|
482
|
+
|
|
483
|
+
- **Enhanced Terminal** - `examples/enhanced.html`
|
|
484
|
+
- Complete interactive terminal with all effects
|
|
485
|
+
- Real-time controls
|
|
486
|
+
- Showcase of all presets
|
|
487
|
+
|
|
488
|
+
### Code Examples
|
|
489
|
+
|
|
490
|
+
#### Animated Logo
|
|
491
|
+
|
|
492
|
+
```javascript
|
|
493
|
+
const ascii = create();
|
|
494
|
+
const logo = ascii.createArt('#logo');
|
|
495
|
+
|
|
496
|
+
await logo.preset('rainbow');
|
|
497
|
+
logo.play();
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
#### Typewriter Effect
|
|
501
|
+
|
|
502
|
+
```javascript
|
|
503
|
+
const text = ascii.createArt('#greeting');
|
|
504
|
+
|
|
505
|
+
await text.typewriter({ speed: 80 });
|
|
506
|
+
text.play();
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
#### Procedural Background
|
|
510
|
+
|
|
511
|
+
```javascript
|
|
512
|
+
const bg = ascii.createBackground('#bg', {
|
|
513
|
+
cols: 80,
|
|
514
|
+
rows: 40,
|
|
515
|
+
charset: ' .:-=+*#%@'
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
bg.play();
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
#### Custom Effect Chain
|
|
522
|
+
|
|
523
|
+
```javascript
|
|
524
|
+
await art
|
|
525
|
+
.scramble({ duration: 1000 })
|
|
526
|
+
.then(() => art.reveal({ duration: 1500 }))
|
|
527
|
+
.then(() => art.wave());
|
|
528
|
+
|
|
529
|
+
art.play();
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
#### Full Matrix Effect
|
|
533
|
+
|
|
534
|
+
```javascript
|
|
535
|
+
const ascii = create();
|
|
536
|
+
|
|
537
|
+
// Background with scanlines
|
|
538
|
+
const bg = ascii.createBackground('#bg', {
|
|
539
|
+
cols: 100,
|
|
540
|
+
rows: 40
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
// Text with matrix rain
|
|
544
|
+
const text = ascii.createArt('#matrix-text');
|
|
545
|
+
await text.preset('matrix');
|
|
546
|
+
|
|
547
|
+
// Play both
|
|
548
|
+
bg.play();
|
|
549
|
+
text.play();
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
#### Sequential Animation
|
|
553
|
+
|
|
554
|
+
```javascript
|
|
555
|
+
const ascii = create();
|
|
556
|
+
const logo = ascii.createArt('#logo');
|
|
557
|
+
|
|
558
|
+
// Effect sequence
|
|
559
|
+
async function animate() {
|
|
560
|
+
await logo.scramble({ duration: 800 });
|
|
561
|
+
await logo.reveal({ duration: 1200 });
|
|
562
|
+
await logo.colorCycle();
|
|
563
|
+
logo.play();
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
animate();
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
## Documentation
|
|
570
|
+
|
|
571
|
+
- [Complete API Reference](docs/api.md) - Detailed documentation of all APIs and methods
|
|
572
|
+
- **Live Examples** - Run `npm run dev` and open `examples/enhanced.html` - Complete interactive terminal
|
|
573
|
+
- Custom Effects Guide - See "Advanced Usage" section in [docs/api.md](docs/api.md)
|
|
574
|
+
|
|
575
|
+
## Development
|
|
576
|
+
|
|
577
|
+
```bash
|
|
578
|
+
# Install dependencies
|
|
579
|
+
npm install
|
|
580
|
+
|
|
581
|
+
# Development server
|
|
582
|
+
npm run dev
|
|
583
|
+
|
|
584
|
+
# Production build
|
|
585
|
+
npm run build
|
|
586
|
+
|
|
587
|
+
# Run tests
|
|
588
|
+
npm test
|
|
589
|
+
|
|
590
|
+
# Tests with UI
|
|
591
|
+
npm run test:ui
|
|
592
|
+
|
|
593
|
+
# Linter
|
|
594
|
+
npm run lint
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
## Use Cases
|
|
598
|
+
|
|
599
|
+
- **Landing Pages** - Eye-catching ASCII art headers
|
|
600
|
+
- **Developer Portfolios** - Terminal-style effects
|
|
601
|
+
- **Retro Websites** - 80s/90s aesthetic
|
|
602
|
+
- **Creative Projects** - Generative ASCII art
|
|
603
|
+
- **Games** - Retro game UIs
|
|
604
|
+
- **Dashboards** - Terminal-style monitors
|
|
605
|
+
- **Presentations** - Slides with unique animations
|
|
606
|
+
- **Interactive Art** - Creative web installations
|
|
607
|
+
|
|
608
|
+
## Browser Support
|
|
609
|
+
|
|
610
|
+
| Browser | Minimum Version |
|
|
611
|
+
|---------|----------------|
|
|
612
|
+
| Chrome | 90+ |
|
|
613
|
+
| Firefox | 88+ |
|
|
614
|
+
| Safari | 14+ |
|
|
615
|
+
| Edge | 90+ |
|
|
616
|
+
|
|
617
|
+
Requires ES2022+ support.
|
|
618
|
+
|
|
619
|
+
## Architecture
|
|
620
|
+
|
|
621
|
+
```
|
|
622
|
+
ascii-script/
|
|
623
|
+
├── src/
|
|
624
|
+
│ ├── index.js # Main entry point
|
|
625
|
+
│ ├── presets.js # Pre-configured presets
|
|
626
|
+
│ ├── core/ # Core engine
|
|
627
|
+
│ │ ├── engine.js # Animation loop
|
|
628
|
+
│ │ ├── registry.js # Effect registry
|
|
629
|
+
│ │ └── timing.js # Timing system
|
|
630
|
+
│ ├── effects/ # Available effects
|
|
631
|
+
│ │ ├── base-effect.js # Base effect class
|
|
632
|
+
│ │ ├── ascii-art/ # ASCII art effects
|
|
633
|
+
│ │ ├── procedural/ # Procedural effects
|
|
634
|
+
│ │ └── text/ # Text effects
|
|
635
|
+
│ └── render/ # Rendering systems
|
|
636
|
+
│ ├── base-instance.js
|
|
637
|
+
│ ├── canvas-grid.js
|
|
638
|
+
│ └── text-block.js
|
|
639
|
+
├── examples/ # Usage examples
|
|
640
|
+
├── tests/ # Test suite
|
|
641
|
+
└── docs/ # Documentation
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
## Performance
|
|
645
|
+
|
|
646
|
+
- **Core bundle**: ~5kb gzipped
|
|
647
|
+
- **Effects**: 3-5kb each (lazy loaded)
|
|
648
|
+
- **Target**: 60fps rendering
|
|
649
|
+
- **GPU Acceleration**: Via CSS transforms
|
|
650
|
+
- **Automatic fallback**: Canvas for large art (>100 lines)
|
|
651
|
+
- **Tree-shaking**: Import only what you use
|
|
652
|
+
|
|
653
|
+
## License
|
|
654
|
+
|
|
655
|
+
MIT © 2026
|
|
656
|
+
|
|
657
|
+
## Contributing
|
|
658
|
+
|
|
659
|
+
Contributions are welcome! Please:
|
|
660
|
+
|
|
661
|
+
1. Fork the repository
|
|
662
|
+
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
|
|
663
|
+
3. Commit your changes (`git commit -m 'Add: AmazingFeature'`)
|
|
664
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
665
|
+
5. Open a Pull Request
|
|
666
|
+
|
|
667
|
+
## Credits
|
|
668
|
+
|
|
669
|
+
Created for the ASCII art community.
|