SHNUnitBezier 1.0.1

SHNUnitBezier 1.0.1

测试已测试
语言语言 CC
许可证 自定义
发布最后发布2015年4月

Shaun Harrison维护。



  • Shaun Harrison

基于 C 的 Unit Bezier 求解器/插值计算库,从 WebKit 转移到 iOS/OS X 使用

使用方法

// 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.872

current = SHNUnitBezierInterpolate(SHNUnitBezierEaseIn, time / duration, duration, from, to);
NSLog(@"Ease in: %.03f", current); // Ease in: 1.290

current = 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

许可证

GNU 通用公共许可证(从 WebKit 继承而来)