🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More
Socket
Sign inDemoInstall
Socket

@mapbox/unitbezier

Package Overview
Dependencies
Maintainers
14
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/unitbezier

unit bezier curve interpolation

0.0.1
latest
Source
npm
Version published
Weekly downloads
1.9M
-1.53%
Maintainers
14
Weekly downloads
 
Created

What is @mapbox/unitbezier?

@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.

What are @mapbox/unitbezier's main functionalities?

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');

Other packages similar to @mapbox/unitbezier

Keywords

unit

FAQs

Package last updated on 22 Oct 2021

Did you know?

Socket

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.

Install

Related posts