Animated stroke tracing for web and terminal. Create beautiful SVG animations with a unified API across different platforms.
CLI-Trace is available on npm. Choose the package that fits your needs:
npm install cli-trace-corenpm install cli-trace-renderer-webnpm install cli-trace-renderer-reactnpm install cli-trace-renderer-ttynpm install -g cli-trace-cligit clone https://github.com/sicmundu/cli-trace.git
cd cli-trace
npm install- SVG Stroke Animation - Beautiful animated path tracing
- Multi-Platform - Web (SVG/Canvas), Terminal (ANSI/Braille), React
- High Performance - Optimized Bézier curve calculations
- TypeScript - Full type safety and excellent DX
- Terminal Rendering - Unicode Braille patterns and ANSI colors
- Modular Architecture - Use only what you need
- Interactive Demo - Live playground and examples
import { createSvgTracer } from 'cli-trace-renderer-web';
const tracer = createSvgTracer('#container', {
durationMs: 2000,
easing: 'easeInOutCubic'
});
tracer.loadSVG('<svg>...</svg>');import { Trace } from 'cli-trace-renderer-react';
<Trace
source={{ svg: svgString }}
options={{ durationMs: 1500, loop: true }}
width={400}
height={300}
/># Install CLI
npm install -g cli-trace-cli
# Live animation
cli-trace live --svg logo.svg --duration 2000 --loop
# Export to HTML
cli-trace html --svg logo.svg --out animation.htmlThis monorepo contains several packages:
cli-trace-core- Core utilities and typescli-trace-parser-svg- SVG parsing and path normalizationcli-trace-renderer-web- Web renderers (SVG/Canvas)cli-trace-renderer-react- React components and hookscli-trace-renderer-tty- Terminal renderer with Braille/ANSIcli-trace-cli- Command-line interfacecli-trace-demo-site- Interactive playground
# Install all packages
pnpm install
# Build all packages
pnpm run build
# Start demo site
cd apps/demo-site && pnpm run devimport { SVGRenderer } from 'cli-trace-renderer-web';
const renderer = new SVGRenderer({
container: document.getElementById('animation'),
width: 400,
height: 300
});
// Load and animate SVG
const pathElement = renderer.loadSVG(svgContent);
await renderer.animate(2000);import { ttyTrace } from 'cli-trace-renderer-tty';
await ttyTrace(
{ svg: svgContent },
{ durationMs: 3000, mode: 'braille', loop: true }
);import { useTrace } from 'cli-trace-renderer-react';
function AnimatedLogo() {
const { progress, isPlaying, play, stop } = useTrace({
source: { svg: logoSvg },
duration: 2000,
loop: true,
});
return (
<div>
<canvas id="logo-canvas" width="400" height="300" />
<button onClick={isPlaying ? stop : play}>
{isPlaying ? 'Stop' : 'Play'}
</button>
<p>Progress: {(progress * 100).toFixed(1)}%</p>
</div>
);
}interface TraceSource {
svg?: string;
paths?: string[];
text?: { value: string; fontUrl?: string };
}
interface TraceOptions {
durationMs: number;
delayMs?: number;
loop?: boolean;
easing?: EasingFunction;
direction?: 'forward' | 'reverse' | 'yoyo';
strokeWidth?: number;
}const tracer = createSvgTracer(container, options);
await tracer.animate(duration, easing);<Trace source={source} options={options} renderer="canvas" />cli-trace live --svg file.svg --duration 2000
cli-trace export --svg file.svg --out video.mp4
cli-trace html --svg file.svg --out snippet.html
cli-trace infoCLI-Trace automatically detects terminal capabilities:
- True Color: 16M colors (if supported)
- 256 Colors: Extended ANSI palette
- Basic Colors: 16-color ANSI
- Braille: Unicode Braille patterns for high-res graphics
- Box Drawing: ASCII box characters as fallback
Supported terminals:
- iTerm2, Terminal.app, kitty, WezTerm
- Alacritty, GNOME Terminal, Konsole
- Windows Terminal, Hyper
import { easings } from 'cli-trace-core';
const customEasing = [0.25, 0.1, 0.25, 1]; // Cubic bezierconst presets = {
simple: { durationMs: 2000, easing: 'linear' },
bounce: { durationMs: 1500, easing: 'easeOutBounce' },
glow: { durationMs: 3000, easing: 'easeInOutCubic' },
};# Install dependencies
pnpm install
# Build all packages
pnpm run build
# Run tests
pnpm run test
# Start demo site
pnpm --filter cli-trace-demo-site run dev
# Build CLI
pnpm --filter cli-trace-cli run build- Core animation engine
- SVG parsing and normalization
- Web renderers (SVG/Canvas)
- React integration
- Terminal rendering (Braille/ANSI)
- CLI application
- Interactive demo site
- Video/GIF export (Puppeteer + FFmpeg)
- Animation presets
- Vue/Svelte components
- WebWorker optimization
- Advanced easing functions
Contributions welcome! Please see our Contributing Guide.
MIT License - see LICENSE file for details.
- SVG path parsing inspired by existing libraries
- Braille rendering techniques from terminal graphics projects
- Animation easing functions based on standard CSS specifications