JSPM

bezier-tweaker

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q24243F
  • License MIT

Small UI for adjusting 1-dimensional bezier curves

Package Exports

  • bezier-tweaker

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bezier-tweaker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

bezier-tweaker Flattr this!experimental

Small UI for adjusting 1-dimensional bezier curves.

Usage

bezier-tweaker

tweaker = bt([opts])

Creates a new UI for adjusting a bezier curve, returning an EventEmitter with the following properties:

  • tweaker.el: the SVG element containing the UI.
  • tweaker.points: the Y positions for each control point, ranging from 0 to 1.
  • tweaker.interpolate: an interpolation function that takes an X value between 0 and 1, returning a Y value between 0 and 1. Useful for live-updating animations.

Takes the following options:

  • precision: The amount of points to draw in the line. Defaults to 50.
  • degrees: Number of points to use in the curve. Defaults to 4.
  • padding: Padding around the UI, in pixels. Defaults to 50.
  • height: Height (not including padding), in pixels. Defaults to 200.
  • width: Width (not including padding), in pixels. Defaults to 200.
  • control: Pass in a custom array of control points.

tweaker.on('update', handle)

Emitted every time the curve is updated, passing along the array of control points (also available at tweaker.points) as the first argument.

License

MIT. See LICENSE.md for details.