
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
@mapbox/unitbezier
Advanced tools
@mapbox/unitbezier is a JavaScript library for working with unit Bezier curves. It allows you to create and manipulate cubic Bezier curves, which are commonly used in animations and transitions in web development.
Creating a UnitBezier instance
This feature allows you to create a new instance of a UnitBezier curve by specifying the control points. The control points determine the shape of the Bezier curve.
const UnitBezier = require('@mapbox/unitbezier');
const bezier = new UnitBezier(0.42, 0, 0.58, 1);
Solving for X given T
This feature allows you to solve for the X coordinate of the Bezier curve given a parameter T. This is useful for animations where you need to determine the position of an element at a specific point in time.
const x = bezier.solve(0.5, UnitBezier.prototype.epsilon);
Solving for Y given T
This feature allows you to solve for the Y coordinate of the Bezier curve given a parameter T. Similar to solving for X, this is useful for determining the vertical position of an element in an animation.
const y = bezier.solve(0.5, UnitBezier.prototype.epsilon, 'y');
The bezier-easing package provides similar functionality for creating and manipulating cubic Bezier curves. It is widely used for easing animations and transitions. Compared to @mapbox/unitbezier, bezier-easing offers a more user-friendly API and additional features like pre-defined easing functions.
The cubic-bezier package is another alternative for working with cubic Bezier curves. It offers a simple API for creating Bezier curves and solving for coordinates. While it provides similar core functionalities as @mapbox/unitbezier, it lacks some of the advanced features and optimizations found in @mapbox/unitbezier.
Unit bezier interpolation function: a port to JavaScript from Webkit:
http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/UnitBezier.h
Initialize a new bezier curve given the points
Evaluate bezier for value x
(ranging from 0 to 1) with epsilon
precision (1e-6 by default).
FAQs
unit bezier curve interpolation
The npm package @mapbox/unitbezier receives a total of 1,784,427 weekly downloads. As such, @mapbox/unitbezier popularity was classified as popular.
We found that @mapbox/unitbezier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.