0.6.1 • Published 10 months ago

@daeinc/draw v0.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@daeinc/draw

drawing utilities for HTML5 Canvas.

Install

npm i @daeinc/draw

then,

import { ... } from "@daeinc/draw"

CDN

import { ... } from "https://cdn.jsdelivr.net/npm/@daeinc/draw/dist/draw.esm.js"

Functions

It uses two custom types, Pt and Pts, each representing number[] and Pt[].

import type { Pt, Pts } from "@daeinc/geom";

drawCircle

const drawCircle: (ctx: CanvasRenderingContext2D, pt: Pt, diam: number) => void;

drawFillText

const drawFillText: (
  ctx: CanvasRenderingContext2D,
  msg: string,
  pt: Pt,
) => void;

drawLine

const drawLine: (ctx: CanvasRenderingContext2D, pt1: Pt, pt2: Pt) => void;

drawPath

const drawPath: (
  ctx: CanvasRenderingContext2D,
  path: Pts,
  close?: boolean,
) => void;

drawSmoothPath

const drawSmoothPath: (ctx: CanvasRenderingContext2D, path: Pts) => void;

Uses quadratic curves to smoothen hard edges of path. The input path is expected to be generated with generateSmoothPath() from another package @daeinc/geom.

License

MIT

0.6.1

10 months ago

0.6.0

10 months ago

0.5.0

1 year ago

0.3.0

2 years ago

0.4.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago