- (CGFloat)maxDurationFromAnimations:(NSArray*)anims{
CGFloat maxDuration = 0;
for (CAAnimation *anim in anims) {
maxDuration = MAX(anim.beginTime + anim.duration * (CGFloat)(anim.repeatCount == 0 ? 1.0f : anim.repeatCount) * (anim.autoreverses ? 2.0f : 1.0f), maxDuration);
}
if (maxDuration == INFINITY) {
maxDuration = 1000.0f;
}

return maxDuration;
}
