Skip to content
Projects

About

好用的 Canvas 引擎,leafer 是核心代码库,leafer-ui 是入口仓库(stars 4.5k)。

Other Projects

How these counts are measured

Measured star growth

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README-EN.md

Original

English | 简体中文


LeaferJS: An Easy-to-Use Canvas Engine

Build interactive, editable graphics apps with ease — The Infinite Canvas Engine for the AI Era

Everyone can create with AI Skills

Official Website: leaferjs.com

Open Forest: leafer.pro

PxGrow: pxgrow.com

👉 A Canvas engine that can handle 1 million graphics in the browser
👉 A Canvas core capable of building Figma-level editors

Extreme Performance · Ultra-Low Memory · DOM-like API · Graphic Editing · Cross-Platform · Zero Dependencies · Lightweight (70KB min+gzip)

NPM Downloads GitHub Stars GitHub Release GitHub License

🧐 Why Choose LeaferJS?

In Web graphics development, developers often face a trade-off between performance and usability.

LeaferJS aims to eliminate this compromise. Rebuilt from the ground up, it not only pushes the limits of Web rendering and interaction performance, but also pursues ultimate simplicity in developer experience. It is a standardized engine designed for productivity tools handling large-scale, high-density, and massive-layer graphics.

🏗️ Why an Infinite Canvas Engine for the AI Era?

With the explosion of AI-generated content, the challenge for graphics engines has shifted from “how to render” to “how to organize and refine”:

  • ⚡ Extreme Capacity: Handles millions of interactive layers smoothly, perfectly accommodating massive AI-generated fragments.
  • 🤖 Semantic Editing: A structured scene tree allows AI to manipulate graphics like the DOM, enabling true AI collaborative workflows.
  • 🛠️ Native Editor: Built-in Editor plugin enables one-click access to industrial-grade editing features such as rotation, scaling, and multi-selection for AI-generated content.

Skills | MCP | Ask AI

🎨 Use Cases

With its extreme performance and standardized capabilities, LeaferJS is an ideal foundation for:

  • 🤖 AI Applications: Infinite AI canvas, AI design tools, generative UI interactions.
  • 🛠️ Productivity Tools: Graphic editors, online design platforms (Figma/Canva-like), whiteboards, low-code engines.
  • 📊 Industrial Visualization: Large-scale node systems, flowcharts, asset monitoring, massive topology diagrams.
  • 🎬 Digital Content Generation: Batch image/poster generation, short video frame rendering (Node.js), interactive H5.
  • 🎮 Interactive Applications: Lightweight games, brand interactive apps, high-frequency data dashboards.

🔥 Performance

LeaferJS pushes the ceiling of Web graphics processing by approximately 10x.

Test (1M Interactive Rectangles) Traditional Canvas Libraries LeaferJS Improvement
Initial Render Time ~9–15 seconds 1.28s ~8x faster 🎉
Memory Usage ~2-4GB (may crash browser) 320MB ~8x lower
Drag FPS (single element) 0–4 FPS 60 FPS ~15x faster

Test environment: 2K laptop screen / Chrome V143.0. Results are for reference only; actual performance depends on hardware.

Performance Details | Benchmark

⚡️ Core Capabilities

  • 🎨 Powerful Graphics System: Complete scene tree supporting vector graphics, SVG paths, and pixel operations.
  • 🧠 Ultra-Fast Interaction: Native support for drag, zoom, multi-touch, and millisecond-level hit testing.
  • 🛠️ Built-in Editor Support: Integrated Editor plugin enabling scale, rotate, move, multi-select with one click.
  • 🧩 Modern Layout Engine: Rare native Flexbox layout support in a Canvas engine — as natural as writing HTML.
  • 🎬 State-Driven Animation: Built-in high-performance transitions and path animations for smooth dynamic interactions.
  • 🌍 Cross-Platform: One codebase runs seamlessly on Web, Node.js, WeChat Mini Programs, and mobile H5.

Full Feature List | Live Examples

🛠️ Quick Start

npm install leafer-ui

# When using plugins, it is recommended to install core packages together
# to avoid version mismatch issues
npm install leafer-ui @leafer-ui/core @leafer-ui/draw
import { Leafer, Rect } from 'leafer-ui'

// Create an interactive app that adapts to the window
const leafer = new Leafer({ view: window })

// Create a draggable rectangle
const rect = new Rect({
  x: 100,
  y: 100,
  width: 200,
  height: 200,
  fill: '#32cd79',
  draggable: true,
})

leafer.add(rect)

Run Online Example | Editor Example

💼 Commercial Support & Sustainability

There is a significant gap between “an engine” and “a mature product.” To ensure long-term maintenance of the open-source engine and help enterprises overcome complex development challenges, we’ve built a transparent and sustainable ecosystem:

  • LeaferJS is Permanently Open Source (MIT): The core features and essential plugins will always remain open source and freely available, meeting the needs of the vast majority of projects. Developers can rely on a secure, controllable, and sustainable technology choice without worrying that core capabilities will become commercially restricted.
  • PxGrow Provides Optional Commercial Plugins: Focused on solving complex challenges in industrial-grade applications, including a professional design editor suite and high-performance solutions for specialized scenarios, helping enterprises save months or even years of development effort.
  • A Virtuous Cycle with a Long-Term Vision: Developers benefit from open source, enterprises gain efficiency through commercial capabilities, and commercial support continuously drives the growth and innovation of LeaferJS—creating an open, transparent, and sustainable ecosystem.

LeaferJS Repository Overview

Repository Description Link
LeaferJS Main integration repo (runnable) GitHub
leafer Core engine GitHub
leafer-ui UI layer GitHub
leafer-in Official plugins GitHub
leafer-x Community plugins showcase GitHub
test Automated testing GitHub
code Example code GitHub
docs Documentation GitHub
leafer-ai Skills GitHub

🌟 Five Years of Dedication, Staying True to Our Vision

LeaferJS started in 2021 and is an original open-source graphics engine that has been continuously developed and refined for over five years. We are committed to standardizing the foundations of graphics systems, allowing developers to focus on product creativity rather than underlying implementations.

If you support original innovation, please give us a Star!

  • 🌟 Star the Repository: Your recognition means a lot to us.
  • 🐞 Submit Feedback: Every issue is an opportunity for us to improve.
  • 🤝 Join the Community: Explore the limits of Web graphics technology with fellow developers.

Contributing

When you use LeaferJS, you become part of this vibrant community — stepping into a growing “tech castle.” Only through collective participation can it truly flourish.

Code of Conduct

Commit Convention

How to Ask Questions the Smart Way

Thanks to Our Contributors

Every creator who has participated in the Open Source Forest

Every community member who has contributed code

Early community members who helped build the ecosystem

Thanks to Our Sponsors

Every user who has supported us through sponsorship

License

MIT License — free to use, including for commercial applications.

Copyright © 2023-present Chao (Leafer) Wan

Explore related projects

Loading…