Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shnhrrsn/shnunitbezier
C based Unit Bezier solver/interpolator ported from WebKit for use on iOS and OS X
https://github.com/shnhrrsn/shnunitbezier
Last synced: 26 days ago
JSON representation
C based Unit Bezier solver/interpolator ported from WebKit for use on iOS and OS X
- Host: GitHub
- URL: https://github.com/shnhrrsn/shnunitbezier
- Owner: shnhrrsn
- License: gpl-2.0
- Created: 2015-02-21T20:26:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-30T18:41:13.000Z (over 9 years ago)
- Last Synced: 2024-09-13T03:59:36.807Z (about 2 months ago)
- Language: C
- Homepage:
- Size: 190 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
# SHNUnitBezier
C based Unit Bezier solver/interpolator ported from WebKit for use on iOS/OS X
## Usage
```c
// Setup some predefined values
const double from = 0.0;
const double to = 10.0;double duration = 1.0;
double time = 0.3;double current;
// Using predefined bezier curves:
current = SHNUnitBezierInterpolate(SHNUnitBezierEaseInOut, time / duration, duration, from, to);
NSLog(@"Ease in/out: %.03f", current); // Ease in/out: 1.872current = SHNUnitBezierInterpolate(SHNUnitBezierEaseIn, time / duration, duration, from, to);
NSLog(@"Ease in: %.03f", current); // Ease in: 1.290current = SHNUnitBezierInterpolate(SHNUnitBezierEaseOut, time / duration, duration, from, to);
NSLog(@"Ease out: %.03f", current); // Ease out: 4.460// Using a linear curve:
current = SHNUnitBezierInterpolate(SHNUnitBezierLinear, time / duration, duration, from, to);
NSLog(@"Linear: %.03f", current); // Linear: 3.047// Or, using a custom bezier curve:
current = SHNUnitBezierInterpolate(SHNUnitBezierMake(0.4, 0.01, 0.16, 1.0), time / duration, duration, from, to);
NSLog(@"Custom: %.03f", current); // Custom: 3.992
```## License
GNU General Public License (inherited from WebKit)