- (void)fixBeginTimeAnimation:(CAAnimation*)anim beginTime:(CFTimeInterval)beginTime endTime:(CFTimeInterval)endTime{
if (beginTime == 0) {
return;
}

if ([anim isKindOfClass:[CAKeyframeAnimation class]] || [anim isKindOfClass:[CABasicAnimation class]]) {
CGFloat duration = anim.duration;
CGFloat excessTime = endTime - duration;
CGFloat excessFract = excessTime/duration;
anim.duration +=  excessTime+0.01 ;
anim.speed = 1 + excessFract;
}else if ([anim isKindOfClass:[CAAnimationGroup class]]){
for (CAAnimation *subAnim in [(CAAnimationGroup*)anim animations]) {
[self fixBeginTimeAnimation:subAnim beginTime:beginTime endTime:endTime];
}
}
}