Skip to main content

Fuderu

Stable 1.5.3 canvas drawing engine for the web

Framework-AgnosticTypeScript-FirstBrush EngineLayer Stack & Alpha LockSelection & Transform ToolsClipboard PipelineAction Replay StreamDocument Persistence API
Try Fuderu in the browser

Draw directly on the demo canvas and explore pressure-aware brush rendering and layer management.

Loading demo…

What Makes Fuderu Special?​

Fuderu is designed for developers who want to build beautiful drawing experiences without the complexity of heavy graphics libraries. Whether you're building a simple sketch pad, a professional annotation tool, or a creative art application, Fuderu gives you the building blocks you need.

Fuderu 1.5.3 brings a complete, professional artist workstation to the browser: featuring Selection Tools (rectangle, ellipse, freehand lasso, and marching ants), Floating Interactive Transformations (move, rotate, scale, and flip with live handles), Cross-Layer & Cross-Document Clipboard Pipeline (cut, copy, paste), a serializable Operation Log & Action Replay Stream API (action:record, stroke:record, replay), first-class Document Persistence with automated schema migrations, layer-level Alpha Lock and Layer Lock, native scanline flood fill, shape primitives, raster text, and typed state event subscriptions.

🎨 Key Capabilities​

Unlike general-purpose canvas libraries, Fuderu combines a standalone brush engine with a full layer compositing stack, artist tools, and document state system:

βœ‚οΈ Artist Tools: Selection, Transform & Clipboard (v1.5.0)​

  • Selection Tools: Rectangular, elliptical, and freehand lasso selections with Boolean combine modes (replace, add, subtract, intersect), animated marching ants rendering (renderSelectionOutline), and automatic tool clipping.
  • Transform Operations: Interactive floating transform sessions (beginTransform, commitTransform, cancelTransform) with live resize handles, rotation handle stem, center pivot, and one-shot transformation helpers (translate, rotate, scale, flipHorizontal, flipVertical).
  • Clipboard Pipeline: Unified clipboard store (ClipboardStore, copy, cut, paste) enabling raster selection and layer region transfers across layers and separate documents, with optional new layer creation, marquee wrapping, and system clipboard interoperability.

πŸ“„ Document Persistence API​

Export and import complete canvas state as versioned JSON containing dimensions, layer metadata, active selections, and serialized image data (exportDocument, importDocument), or export flattened PNG composition renders (exportPNG). Includes automatic forward schema migration (migrateDocument).

πŸ”’ Advanced Layer Stack & Alpha Lock​

16 blend modes, opacity, visibility, layer reordering, Alpha Lock (restricting drawing/filling to existing non-transparent pixels), and Layer Lock (protecting layers against accidental edits or deletions).

πŸͺ£ Native Raster Operations & Shapes​

Built-in scanline flood fill (floodFill), vector shape primitives (drawRectangle, drawEllipse, drawLine), raster text rendering (drawText), and pixel color sampling (getColorAt).

⚑ Reactive Event System & Timeline History​

Subscribe to typed state events (change, stroke:start, stroke:end, layer:change, history:change, selection:change, transform:start, clipboard:copy) with immutable getSnapshot(), and navigate history timeline directly with canvas.history.goTo(index) or sparse memory patches.

🎬 Reliable Action Replay Stream & Artwork Reset (v1.5.3)​

Record every user interaction as a serializable action log and play it back programmatically at adjustable speeds (canvas.replay()), with synchronous point flushing (Brush.flush()), base layer identity preservation across resets (canvas.resetArtwork()), and active layer fallbacks for multiplayer or cross-canvas playback.

✨ Smooth Interpolation & Adaptive Spacing​

Natural-looking strokes that connect points intelligently, eliminating jagged lines using Bezier curve algorithms with adaptive brush stamp density for consistent texture at any drawing speed.

πŸ–±οΈ Pressure Sensitivity & Image Brushes​

Real pen pressure support with intelligent mouse/touch simulation, plus PNG/WebP custom stamp tips with recoloring and rotation capabilities.

🧩 Built for Integration​

Fuderu is deliberately framework-agnostic - use it with:

  • βš›οΈ React
  • πŸ’™ Vue
  • πŸ’š Svelte
  • 🌐 Vanilla JS/TS
  • ⚑ Next.js
  • πŸ“„ Plain HTML

What You'll Learn​

This documentation is organized around the core experience that matters most for a first stable release:

  1. Create a canvas with the Canvas wrapper
  2. Work with layers for non-destructive composition and blend modes
  3. Tune brush behavior for pressure, spacing, and stroke dynamics
  4. Extend the experience with built-in modules when needed

Getting Started in 60 Seconds​

Here's the fastest way to see Fuderu in action:

npm install fuderu
<canvas id="my-canvas" style="width: 600px; height: 400px"></canvas>
import { Canvas } from "fuderu";

const painter = new Canvas({
canvas: "#my-canvas",
document: {
width: 1200,
height: 800,
},
brush: {
color: "#2563eb",
size: 24,
spacing: 0.25,
},
});

// Start drawing immediately!
// Try changing colors, sizes, or try the eraser mode
painter.loadConfig({
color: "#dc2626",
size: 12,
});

πŸ’‘ Tip: Try pressing harder with your stylus (or moving your mouse faster/slower) to see pressure sensitivity in action!

Ready to Dive In?​

Start with our Quick Start tutorial to build your first drawing application, or jump straight to the feature that interests you most:

  • Canvas API - High-level wrapper with built-in event handling
  • Brush API - Low-level brush engine for custom integrations
  • Layer System - Professional non-destructive editing
  • Image Brushes - Stamp with custom textures
  • Modules - Add special effects to your brushes

πŸš€ Let's Get Started!

Head over to the Quick Start guide to build your first drawing application in just minutes!