Crates.io | baiser |
lib.rs | baiser |
version | 0.1.1 |
source | src |
created_at | 2024-07-11 03:52:51.45337 |
updated_at | 2024-07-11 15:01:07.400192 |
description | Curves manipulation library |
homepage | |
repository | https://github.com/monkin/baiser |
max_upload_size | |
id | 1299102 |
size | 33,745 |
Baiser is a Rust library designed to work with curves, providing tools for creating and manipulating them with ease. It offers a variety of curve types, including Bezier curves of different orders, and utilities for composing curves. One of the library's key features is the ability to adjust curves to have linear speed, making it particularly useful for animations, and any application where consistent movement along a curve is required.
Bezier0
(dot), Bezier1
(
line), Bezier2
, Bezier3
), allowing for a wide range of shapes and motions.LinearSpeed
struct that adjusts a given curve to ensure a linear
relationship between time and distance traveled along the curve.CurvePoint
trait. For data types that
implement Distance
trait, building a linear speed curve is as simple as calling Curve::linear_speed
method.Here's a quick example of how to create a linear speed adjusted Bezier curve:
use baiser::Curve;
let linear_speed_curve = Curve::cubic_bezier(v1, v2, v3, v4)
.linear_speed(/* table size */ 64, /* steps count */ 100);
// Now you can use `linear_speed_curve` for operations requiring linear speed
let middle_value = linear_speed_curve.point_at(0.5);
// An example of building a composed curve
let composed_curve = Curve::composed(p0)
.line_to(p1, p2)
.quadratic_to(p3, p4)
.cubic_to(p5, p6, p7);
Contributions are welcome! Please feel free to submit pull requests or open issues to discuss potential improvements or features.
This project is licensed under the MIT License - see the LICENSE file for details.