Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apendua/spline
https://github.com/apendua/spline
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/apendua/spline
- Owner: apendua
- Created: 2013-05-29T08:52:25.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-05-29T09:15:42.000Z (over 11 years ago)
- Last Synced: 2024-10-19T16:47:48.347Z (20 days ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# spline
## Usage
To define a new curve type
```javascript
var curve = new Spline;
```
Now you can add control points to your curve like this:
```javascript
curve.push({
co: { x: 0, y: 1 },
});
curve.push({
co: { x: 1, y: 2 },
});
curve.push({
co: { x: 4, y: -5 },
});
```
and evaluate the curve at any point
```javascript
curve.evaluate(1.1111);
```
Please note that the evaluation function of your curve
will be compiled as soon as you call `curve.evaluate`
for the first time. This may require some additional
computation time.