Request a Demo
  • Platform
    • Donations
    • Campaigns
    • Events
    • eCards
    • CRM
  • Features
  • Integrations
  • Resources
    • Docs
    • Product updates
    • Changelog
  • Company
  • Platform
    • Donations
    • Campaigns
    • Events
    • eCards
    • CRM
  • Features
  • Integrations
  • Resources
    • Docs
    • Product updates
    • Changelog
  • Company
Request a Demo

Classes

  • Helpers/AdminMenuHelper
  • Helpers/API
  • Helpers/Helper

User Guides

  • User Guide: Settings – Advanced (LevCharity Admin Only)
  • User Guide: Settings – P2P Campaigns
  • User Guide: Settings – Account Signup
  • User Guide: Settings – Forms
  • User Guide: Settings – Payment and Currencies
  • User Guide: Settings – About Section
  • User Guide: Managing Recurring Subscriptions
  • How to Add a Contact
  • How to Add an Offline Transaction

Shortcodes

  • Social Share Widget – Internal Guide

JS

  • Globals
  • DOM
  • Canvas API (added with chaiathon)

Getting Started

  • Onboarding

Donations & Payments

  • How to set up a donation form

Crowdfunding Campaigns

  • Creating and Managing Team Campaigns
  • How to use the P2P signup form
  • How to edit a P2P campaign
  • How to add the P2P signup page on your site.

Emails & Notifications

  • How to set up eCard emails
  • How to setup Subscription emails
  • How to set up Confirmations for your emails
  • How to set up Event email notifications
  • How to set up Event emails
  • How to set up emails for P2P campaigns
  • How to set up emails for your Fundraising Campaigns
  • How to Create Emails for Donation Forms (Admin Guide)

Events

  • How to Add an Event

E-Cards

  • How to set up an eCard

Fundraising Campaigns

  • How to set up your campaign

Sponsorships

  • How to add a sponsorship item
View Categories

Canvas API (added with chaiathon)

< 1 min read

Canvas API is a toolkit to draw anything inside HTML Canvas

As Base, it uses JavaScript default Canvas API, but provides the easy way to have draw canvas using simple shapes like Rectangle, Circle, Polygon etc.

Basic usage #

import {Canvas} from 'levcharity/resources/scripts/helpers/Canvas';
import {DOM} from 'levcharity/resources/scripts/helpers/DOM'; // not required to use Canvas


const canvasElement = DOM.create('canvas');
document.body.append(canvasElement);


const canvas = new Canvas(canvasElement);
canvas.inject(new Canvas.Rect({
    width: canvas.canvas.offsetWidth,
    height: canvas.canvas.offsetHeight,
    fill: '#fff',
    radius: 20
}))

canvas.draw(); // async method

Shapes #

Canvas.Circle

Canvas.Curve

Canvas.FreePoyigon

Canvas.ImageRect

Canvas.Line

Canvas.Polygon

Canvas.Rect

Canvas.Text

Canvas.Shape – the base class that provides functionality which used for all shapes, all shapes extending from this class

Was this article helpful?
Still stuck? How can we help?

How can we help?

Updated on March 28, 2025
DOM
Table of Contents
  • Basic usage
  • Shapes
Join our newsletter

Add your email to stay up to date on features and new releases:

loader

  • Docs
  • Changelog
  • Privacy Policy
  • Terms of Service
  • Cookies Settings
  • Docs
  • Changelog
  • Privacy Policy
  • Terms of Service
  • Cookies Settings