What is the equivalent of UIViewAnimationOptionBeginFromCurrentState flag when adding CABasicAnimation directly to the layer? I’d want to override my current animation when I’m adding another one for the same key and make it begin animation from the current state.
E.g, I am adding animations to my layer with the following code.
CABasicAnimation *moveAnimation = [CABasicAnimation animationWithKeyPath:@"position.y"];
moveAnimation.fromValue = [NSNumber numberWithInt:layer.position.y];
moveAnimation.toValue = [NSNumber numberWithInt:0];
moveAnimation.duration = BUBBLE_DEFAULT_ANIMATION_DURATION;
[layer addAnimation:moveAnimation forKey:key];
Any help would be totally appreciated.
Set
fromValuetonilto start from the current presentation layer value.From the documentation for CABasicAnimation: