Small UI for adjusting 1-dimensional bezier curves
Small UI for adjusting 1-dimensional bezier curves.
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.
Emitted every time the curve is updated, passing along the array of control
points (also available at
tweaker.points) as the first argument.
MIT. See LICENSE.md for details.