@rbxts/bezier
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Bezier Curve

Easily calculate points on a bezier curve! Typescript 4+ due to Variadic Tuple Types.

Example

import BezierCurve from "@rbxts/bezier";

const curve = new BezierCurve([
	new Vector3(0, 0, 0),
	new Vector3(100, 0, 0),
	new Vector3(100, 0, 100),
	new Vector3(0, 0, 100),
]);

const base = new Instance("Part");
base.Size = new Vector3(100, 1, 100);
base.Position = new Vector3(50, -1, 50);
base.Parent = game.Workspace;

for (let i = 0; i <= 100; i++) {
	const part = new Instance("Part");
	part.Position = curve.calculate(i / 100);
	part.Size = new Vector3(1, 1, 1);
	part.BrickColor = new BrickColor("Really red");
	part.Parent = game.Workspace;
}

Readme

Keywords

Package Sidebar

Install

npm i @rbxts/bezier

Weekly Downloads

6

Version

0.2.0

License

MIT

Unpacked Size

3.6 kB

Total Files

4

Last publish

Collaborators

  • dionysusnu