Skip to content

A powerful 2d canvas library that allows minimal rendering and provides diverse shapes

License

Notifications You must be signed in to change notification settings

fcanvas/fcanvas

Repository files navigation

fcanvas

A powerful 2d canvas library that allows minimal rendering and provides diverse shapes https://fcanvas.js.org

Close the path when you're done drawing, not fill

GitHub license GitHub Issues Codacy Badge Hits-of-Code

Test CodeQL ESLint Prettier TypeScript Checker Declaration Try build

NPM Size Languages License Star Download

Packages

Name Description
fcanvas The main package provides classes and methods for drawing canvas and manipulating events
@fcanvas/animate plugin that allows connecting gsap to fcanvas to create powerful animations
@fcanvas/communicate This package allows a simple connection between MessageChannel-based channels such as WebWorker, IFrame...
@fcanvas/node Plugin allow use fcanvas in NodeJS
@fcanvas/tile Plugin that allows creating tiles from file
@fcanvas/worker The plugin provides support for using fCanvas in WebWorker

Installation

NPM / Yarn / Pnpm:

pnpm add fcanvas

CDN:

<script src="https://unpkg.com/fcanvas"></script>

Example

import { Stage, Layer, Circle } from "fcanvas"
import { installAnimate } from "@fcanvas/animate"

installAnimate(Shape)

const stage = new Stage({
  container: "app",
  width: 300,
  height: 300
})

const layer = new Layer()
stage.add(layer)

const circle = new Circle({
  x: 0,
  y: 0,
  radius: 20,
  fill: "red"
})

layer.add(circle)

circle.to({
    x: stage.$.width,
    duration: 1
})

If you don't like using @fcanvas/animate you can always use gsap by:

import gsap from "gsap"
...

gsap(circle.$).to({
    x: stage.$.width,
    duration: 1
})

Demos