An Angular2/Angular4 Library for HTML Canvas | ngvas

The ngvas library allows you to control the <canvas> element from within Angular 2 and Angular 4.

html2canvas angular example, convert html to image angular, angular 7 canvas drawing, angular create canvas dynamically

TODOs for 1.0

  • Improve docs.
  • Unit tests with >90% coverage.
  • Improve originToCenter for curves and polygon.
  • Built-in Constraints.
  • Add mouse events: mousedown, mouseup
  • Add other hit area types: vector rectangle, circle.
  • Optimization.

TODOs for 1.x

  • Add drag and drop events.
  • Add HammerJS support.
  • Grouping components.
  • Optimization.
How to make use of it:


$ npm install ngvas –save


import { NgvasModule, tweens, hitAreas } from "ngvas";

  imports:      [ BrowserModule, NgvasModule ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
class AppModule { }
<ngvas [width]="500" [height]="500" (ready)="onNgvasInit()">
    <template ngFor let-rect [ngForOf]="rects">
        <ngvas-rectangle [fill]="rect.color" [translate]="rect.xy" [width]="rect.w" [height]="rect.h" origin="center"></ngvas-rectangle>
    <ngvas-circle [fill]="'#0000ff'" [x]="100" [y]="100" [radius]="50" origin="center" (click)="onClickHandler($event)" [hitArea]="PixelHitArea"></ngvas-circle>

<ngvas>: NgvasComponent Input Bindings

@Input(“name”)Data TypeDescription
activebooleanSets if animation in the canvas is active or not.
widthnumberSets the width of the <canvas> element.
heightnumberSets the height of the <canvas> element.

<ngvas>: NgvasComponent Event Bindings

@Output(“name”)Data TypeDescription
readyNgvasComponentFires once when the component is initialized.

Built-in Tweens

  • easeLinear
  • easeInSine, easeOutSine, easeInOutSine
  • easeInQuint, easeOutQuint, easeInOutQuint
  • easeInQuart, easeOutQuart, easeInOutQuart
  • easeInQuad, easeOutQuad, easeInOutQuad
  • easeInExpo, easeOutExpo, easeInOutExpo
  • easeInElastic, easeOutElastic, easeInOutElastic
  • easeInCircular, easeOutCircular, easeInOutCircular
  • easeInBack, easeOutBack, easeInOutBack
  • easeInBounce, easeOutBounce, easeInOutBounce
  • easeInCubic, easeOutCubic, easeInOutCubic

angular 4 module for html canvas, ngvas Plugin/Github

See Demo And Download

Official Website(patrimart): Click Here

This superior jQuery/javascript plugin is developed by patrimart. For extra advanced usage, please go to the official website.

Related Posts


Create Side Sliders Input Values Using Mouse Drag | Pointer Lock

HTML Range Slider is a lightweight library to create side sliders to adjust values easily and precisely by making use of the Pointer Lock API. Side Slider…


Smooth and Lightweight Parallax Scroll Library in Pure Javascript

Lightweight and seamless parallax scrolling library implemented in pure javascript using hardware acceleration for additional performance. Main Features Extremely lightweight with no dependencies A few kilobytes of pure…


How to Convert Form Data to JSON with HTML Forms | FormsJS

FormsJS is a simple-to-use JavaScript library that covers type subject values to JSON in real time. The items containing the data category will be analyzed automatically. It…


A Small jQuery Extension to Convert An Editable HTML Table

Editable Table is a small jQuery extension to convert an editable HTML table for fast data entry and validation. A small jQuery extension to convert a static…

Simple jQuery Plugin for Embedding YouTube Videos As Cover Background is a jQuery plugin built to facilitate YouTube embeds as cover wallpaper using the YouTube Embed API. There is another jQuery Youtube Video Background plugin that…


Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…