Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bezier-utils

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bezier-utils

bezier utils

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

###bezier utils

calculate bezier curve using De Casteljau's algorithm. We can divide bezier curve to any sub curves by using bezier utils.

###API

/*
 * get bezier curve function
 * @return curve function: time (0 ~ 1) => point ({x, y})
 * @param control points, array
 * point is an object of shape {x, y}
*/
getBezierCurve

/*
 * get sub bezier curve control points
 * @return sub points, eg: [firstPoints, secondPoints]
 * @param control points of parent bezier curve, array
 * @param split time, float from 0 to 1
*/
getSubBezier

/eg:
const points = [{
    x: 0,
    y: 0
}, {
    x: 1,
    y: 1
}, {
    x: 2,
    y: 0
}]
const parentCurve = getBezierCurve(points);
const [firstPoints, secondPoints] = getSubBezier(points);

const firstSubCurve = getBezierCurve(firstPoints);
const secondSubCurve = getBezierCurve(secondPoints);

Keywords

FAQs

Package last updated on 26 Dec 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc