1 #import <QuartzCore/CAMediaTimingFunction.h>
2 #import <Foundation/NSString.h>
3 #import <Foundation/NSRaise.h>
5 NSString * const kCAMediaTimingFunctionLinear=@"kCAMediaTimingFunctionLinear";
6 NSString * const kCAMediaTimingFunctionEaseIn=@"kCAMediaTimingFunctionEaseIn";
7 NSString * const kCAMediaTimingFunctionEaseOut=@"kCAMediaTimingFunctionEaseOut";
8 NSString * const kCAMediaTimingFunctionEaseInEaseOut=@"kCAMediaTimingFunctionEaseInEaseOut";
9 NSString * const kCAMediaTimingFunctionDefault=@"kCAMediaTimingFunctionDefault";
11 @implementation CAMediaTimingFunction
13 -initWithControlPoints:(float)c1x :(float)c1y :(float)c2x :(float)c2y {
21 +functionWithControlPoints:(float)c1x :(float)c1y :(float)c2x :(float)c2y {
22 return [[[self alloc] initWithControlPoints:c1x:c1y:c2x:c2y] autorelease];
25 +functionWithName:(NSString *)name {
26 if([name isEqualToString:kCAMediaTimingFunctionLinear])
27 return [self functionWithControlPoints:0:0:1:1];
28 if([name isEqualToString:kCAMediaTimingFunctionEaseIn])
29 return [self functionWithControlPoints:0.5:0:1:1];
30 if([name isEqualToString:kCAMediaTimingFunctionEaseOut])
31 return [self functionWithControlPoints:0:0:0.5:1];
32 if([name isEqualToString:kCAMediaTimingFunctionEaseInEaseOut])
33 return [self functionWithControlPoints:0.5:0:0.5:1];
34 if([name isEqualToString:kCAMediaTimingFunctionDefault])
35 return [self functionWithControlPoints:0.25:0.1:0.25:1];
40 -(void)getControlPointAtIndex:(size_t)index values:(float[2])ptr {