Skip to content

Poojan38380/glyphstream

GlyphStream

Dynamic ASCII Art Components for the Browser

Five generative algorithms β€” each a living system, every render unique.

πŸ”— Live Demo Β· πŸ“¦ Components Β· πŸš€ Quick Start Β· πŸ“– API Reference

GlyphStream Homepage
The GlyphStream homepage β€” a live ASCII flow field runs as the hero background.


What is GlyphStream?

GlyphStream is an open-source generative ASCII art engine built for the browser. It uses particle-driven brightness fields, text measurement via pretext, and variable font rendering to create stunning, ever-changing ASCII art.

Each component is a living algorithm β€” not a static image. Every render is unique, driven by seeded randomness and emergent behavior.

Why it's cool

  • 🎨 5 distinct components β€” flow fields, typography, reactive art, ambient backgrounds, and face generation
  • πŸ”§ Designer-first API β€” clean props for fonts, colors, particle counts, seeds
  • ⚑ Zero framework dependency β€” works with vanilla JS, React, Vue, anything
  • 🌈 Color palettes β€” monochrome, gradient, multi-color modes
  • 🎯 Seeded randomness β€” reproduce any render with a seed value
  • πŸ“± Responsive β€” works on any screen size
  • πŸ—οΈ Built on pretext β€” precise text measurement by Cheng Lou

Components

〰️ ASCII Flow Field

Generative ASCII art from layered Perlin noise flow fields. Particles follow vector forces, accumulating into organic density maps.

ASCII Flow Field

Feature Details
Use cases Hero sections, generative backgrounds, loading screens
Modes noise, spiral, waves
Particles 100–2000
Presets calm, turbulent, spiral, waves, static-art
Live Demo β†’

𝐀 ASCII Typography

Particle-driven brightness field rendered with variable font weights, styles, and sizes. Supports proportional AND monospace side-by-side comparison.

ASCII Typography

Feature Details
Use cases Portfolio hero pieces, typography showcases, generative art posters
Font variants Multiple weights (300, 500, 800) Γ— styles (normal, italic)
Attractors lissajous, circular, random, mouse
Panels Proportional + monospace comparison
Live Demo β†’

πŸ–±οΈ ASCII Reactive

ASCII art that responds to user input β€” mouse position, clicks, scroll, or custom data streams.

ASCII Reactive

Feature Details
Use cases Interactive installations, audio visualizers, data-driven art
Input modes mouse, click, scroll, audio, custom
Color modes velocity, position, time, palette
Brush Configurable size, intensity, trail modes
Live Demo β†’

πŸŒ… ASCII Ambient

Slow, meditative ASCII art that evolves over time. Minimal particle count, gentle forces, long decay times.

ASCII Ambient


Watch the ambient background breathe and drift in real-time.

Feature Details
Use cases Ambient screensavers, portfolio backgrounds, meditation apps
Particles 20–80 (low count for minimalism)
Force modes gentle, drift, breathe
Color modes dawn, dusk, midnight, custom
Live Demo β†’

🎭 ASCII Face Generator

Procedurally generated talking faces with random gender, features, and accessories.

ASCII Face Generator

Feature Details
Use cases Fun demos, avatar generation, procedural art
Randomization Gender, eye shape, mouth style, accessories
Color coding Blue tones, pink tones, custom palettes
Live Demo β†’

Quick Start

Clone & Run

git clone https://github.com/Poojan38380/glyphstream.git
cd glyphstream
npm install
npm run dev

Open http://localhost:3001 β€” that's it.

Use in Your Project

Each component is a self-contained TypeScript module. Import and instantiate:

import { AsciiFlowField } from './src/components/ascii-flow-field'

const art = new AsciiFlowField('#container', {
  cols: 80,
  rows: 40,
  particleCount: 600,
  noiseScale: 0.005,
  colorMode: 'gradient',
  palette: ['#c4a35a', '#8b6914', '#4a3520'],
  seed: 42,
})

art.start()
art.setPreset('turbulent')
art.regenerate(123) // new seed, new art

Production Build

npm run build

Output goes to dist/ β€” deploy anywhere as a static site.


API Reference

Common Component API

Every component follows the same pattern:

class AsciiComponent {
  constructor(container: string | HTMLElement, config: ComponentConfig)

  start(): void          // Begin animation
  stop(): void           // Stop animation
  dispose(): void        // Clean up (important for SPAs)
  regenerate(seed?: number): void  // New seed
  setPreset(name: string): void    // Apply a preset
  updateConfig(partial: Partial<ComponentConfig>): void
  getElement(): HTMLElement
}

Configuration Options

All Components

Option Type Default Description
cols number 80 Grid columns
rows number 40 Grid rows
fontSize number 12 Font size in px
fontFamily string 'Georgia, serif' CSS font family
charset string ' .,:;!+-=*#@%' Character ramp (dark β†’ light)
colorMode string 'monochrome' 'monochrome' | 'gradient' | 'palette'
palette string[] [] Array of hex colors
seed number random Random seed for reproducibility
decay number 0.94 Field decay rate (0.0–1.0)

Flow Field Specifics

Option Type Default Description
particleCount number 600 Number of particles
noiseScale number 0.005 Noise zoom level
noiseOctaves number 3 Noise detail level
particleSpeed number 1.0 Speed multiplier
flowMode string 'noise' 'noise' | 'spiral' | 'waves'
monochromeColor string '#c4a35a' Color for monochrome mode

Typography Specifics

Option Type Default Description
weights number[] [300, 500, 800] Font weights
styles string[] ['normal', 'italic'] Font styles
monoFontFamily string 'Courier New, monospace' Monospace font
attractorMode string 'lissajous' 'lissajous' | 'circular' | 'random' | 'mouse'
showMono boolean true Show monospace panel
showSource boolean false Show source simulation
monoTint string 'rgba(130,155,210,0.7)' Monospace panel tint

Reactive Specifics

Option Type Default Description
inputMode string 'mouse' 'mouse' | 'click' | 'scroll' | 'audio' | 'custom'
brushSize number 8 Reactive brush size
brushIntensity number 0.6 Brightness per interaction
trailMode string 'fade' 'fade' | 'accumulate' | 'bounce'

Ambient Specifics

Option Type Default Description
particleCount number 40 Low count (20–80)
speed number 0.15 Very slow evolution
forceMode string 'breathe' 'gentle' | 'drift' | 'breathe'
colorMode string 'dawn' 'dawn' | 'dusk' | 'midnight' | 'custom'
cycleTime number 60000 Full color cycle in ms

Project Structure

glyphstream/
β”œβ”€β”€ README.md                    # You are here
β”œβ”€β”€ PLAN.md                      # Full project vision & architecture
β”œβ”€β”€ package.json                 # Dependencies & scripts
β”œβ”€β”€ vite.config.ts               # Vite MPA configuration
β”œβ”€β”€ vercel.json                  # Vercel deployment config
β”œβ”€β”€ tsconfig.json                # TypeScript configuration
β”‚
β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ index.html               # Homepage (gallery + playground)
β”‚   β”œβ”€β”€ demos/                   # Individual component demos
β”‚   β”‚   β”œβ”€β”€ ascii-flow-field.html
β”‚   β”‚   β”œβ”€β”€ ascii-typography.html
β”‚   β”‚   β”œβ”€β”€ ascii-reactive.html
β”‚   β”‚   β”œβ”€β”€ ascii-ambient.html
β”‚   β”‚   └── ascii-face-generator.html
β”‚   └── src/                     # All source code
β”‚       β”œβ”€β”€ core/                # Core generative engine
β”‚       β”‚   β”œβ”€β”€ brightness-field.ts
β”‚       β”‚   β”œβ”€β”€ char-palette.ts
β”‚       β”‚   β”œβ”€β”€ field-renderer.ts
β”‚       β”‚   β”œβ”€β”€ particle-system.ts
β”‚       β”‚   └── types.ts
β”‚       β”œβ”€β”€ components/          # 5 reusable components
β”‚       β”‚   β”œβ”€β”€ ascii-flow-field/
β”‚       β”‚   β”œβ”€β”€ ascii-typography/
β”‚       β”‚   β”œβ”€β”€ ascii-reactive/
β”‚       β”‚   β”œβ”€β”€ ascii-ambient/
β”‚       β”‚   └── ascii-face-generator/
β”‚       └── utils/               # Shared utilities
β”‚           β”œβ”€β”€ color.ts
β”‚           β”œβ”€β”€ dom.ts
β”‚           └── math.ts
β”‚
β”œβ”€β”€ public/                      # Static assets (screenshots, videos)
└── dist/                        # Production build output

Tech Stack

Layer Technology
Language TypeScript (strict mode)
Build Vite 5 (Multi-Page App)
Text Measurement @chenglou/pretext
Rendering Canvas 2D + DOM
Deployment Vercel (static site)
Dependencies 1 runtime dependency (pretext)

Philosophy

Algorithmic art as living systems β€” beauty emerges from process, not product.

GlyphStream is built on the idea that every render tells a different story. The same seed, the same parameters β€” but watch it breathe, and you'll never see the exact same art twice.


Built With GlyphStream

Projects and demos powered by GlyphStream:

Built something with GlyphStream? Open a PR and add it here!


Contributing

We love contributions! Whether it's:

  • πŸ› Bug fixes
  • ✨ New components
  • 🎨 New presets
  • πŸ“– Documentation improvements
  • πŸš€ Performance optimizations

See CONTRIBUTING.md for guidelines.


License

MIT β€” Free to use, modify, and distribute. Attribution appreciated but not required.


Credits

  • Built by Poojan
  • Text measurement powered by pretext by Cheng Lou
  • Inspired by pretext's variable-typographic-ascii demo

Made with β˜• and ASCII characters

About

🎨 Dynamic ASCII art components for the browser. Five generative algorithms β€” flow fields, typography, reactive, ambient, and faces. Every render unique.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors