-(CAMediaTimingFunction*) GetTiming:(NSString*) name
{
return [CAMediaTimingFunction functionWithName:name];
}
- (void)showLeftLoweAnimation
{
// UIBezierPath *trackPath = [UIBezierPath bezierPath];
// [trackPath moveToPoint:self.leftLowView.center];
CGFloat y;
if (finsh == NO)
{
finsh =YES;
y = 150;
}
else {
y = -1;
}
// CGFloat y =self.leftLowView.frame.origin.y+self.leftLowScrollView.frame.size.height;
CAKeyframeAnimation * animation;
animation = [CAKeyframeAnimation animationWithKeyPath:@"position.y"];
animation.duration = 2.0;
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;
NSMutableArray *values = [NSMutableArray array];
NSMutableArray *timings = [NSMutableArray array];
NSMutableArray *keytimes = [NSMutableArray array];
//Start
[values addObject:[NSNumber numberWithFloat:0.0]];
// [timings addObject:[self GetTiming:kCAMediaTimingFunctionEaseIn ]];
[keytimes addObject:[NSNumber numberWithFloat:0.0]];
//Drop down
[values addObject:[NSNumber numberWithFloat:y]];
// [timings addObject:[self GetTiming:kCAMediaTimingFunctionEaseOut]];
[keytimes addObject:[NSNumber numberWithFloat:0.7]];
// bounce up
[values addObject:[NSNumber numberWithFloat:0.8 * y]];
// [timings addObject:[self GetTiming:kCAMediaTimingFunctionEaseIn]];
[keytimes addObject:[NSNumber numberWithFloat:0.8]];
// fihish down
[values addObject:[NSNumber numberWithFloat:y]];
[keytimes addObject:[NSNumber numberWithFloat:1.0]];
//[timings addObject:GetTiming(kCAMediaTimingFunctionEaseIn)];
animation.values = values;
animation.timingFunctions = timings;
animation.keyTimes = keytimes;
[self.leftLowView.layer addAnimation:animation forKey:nil];
// [CATransaction commit];
}