canvas-curve-through

1.0.0 • Public • Published

Quadratic Curve Through for Canvas

This is a simple utility function that draws a quadratic curve onto a canvas element given a point that the curve must pass through at a given time along the curve.

Illustration

Various Curves

Usage

This module provides a single function with the following signature:

quadraticCurveThrough(ctx, startX, startY, midX, midY, endX, endY, time=0.5)

With Webpack or Node (for server-side canvas see https://github.com/Automattic/node-canvas):

var quadraticCurveThrough = require('canvas-curve-through');
quadraticCurveThrough(<your arguments>);

If you don't use Webpack download this file.

N.B. Unlike the standard path functions you must specify the start point when using this function. This is because the canvas API does not provide a way to retrieve the current point.

Readme

Keywords

Package Sidebar

Install

npm i canvas-curve-through

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • oheard