Open xvno opened 4 years ago
HTML5 Canvas JavaScript framework that extends the 2d context by enabling canvas interactivity for desktop and mobile applications.
forked from Kinetic
Konva enables high performance animations, transitions, node nesting, layering, filtering, caching, event handling for desktop and mobile applications, and much more.
You can draw things onto the stage, add event listeners to them, move them, scale them, and rotate them independently from other shapes to support high performance animations, even if your application uses thousands of shapes.
npm install konva
或者
<script src="https://unpkg.com/konva@4.0.0/konva.min.js"></script>
The stage, layers, groups, and shapes are virtual nodes, similar to DOM nodes in an HTML page.
Konva.Stage
that contains several user’s layers (Konva.Layer
).scene renderer
and a hit graph renderer
.
The
scene renderer
is what you can see, and thehit graph renderer
is a special hidden canvas that’s used for high performance event detection.
Here’s an example Node hierarchy:
Prebuilt shapes & custom shapes
Prebuilt shapes: rectangles, circles, images, sprites, text, lines, polygons, regular polygons, paths, stars, etc Custom shapes: instantiating the
Shape
class and creating adraw
function
layers and shapes can bind event listeners, transform nodes, run animations, apply filters, selectors, and much more.
Styles, Events, Drag & Drop, Filters & Animation & Selectors
Refs