Animations along a curved path not in sync in iOS 7.

Originator:stevekohls
Number:rdar://15544161 Date Originated:2013-11-24
Status:Open Resolved:
Product:iOS Product Version:7.0
Classification:Bug Reproducible:Yes
 
Summary:
This bug is visible in my client's iPad app. I have an example project with code that shows the problem.

I have a CABasicAnimation drawing a path using the key path "strokeEnd" and a CAKeyframeAnimation animating an image along that path using the key path "position". The path is a bezier path composed of one or more curves. When animating, the drawing of the path and the position of the image along the path are not always in sync. Meaning that the image along the path should appear at the same location as the current strokeEnd of the path. During the animation, the strokeEnd appears to move ahead or fall behind the image location. THIS ONLY HAPPENS IN iOS 7! In iOS 5 and 6, the animation works as desired.

If the path is only a straight line (no curves) the animation is in sync.

This same problem was reported by Stack Overflow user user2860400, and the sample project I modified is from SO and github user xjones. HOWEVER, those users were only using CAKeyframeAnimations alone.

My project shows this bug exists when CABasicAnimation and CAKeyframeAnimation are used together.

Steps to Reproduce:
1. I have a simple single-view project the demonstrates the problem. See my code at: https://github.com/stevekohls/AnimatedPaths
2. Run the project on an iOS 7 device or in the simulator for iOS 7 to observe the problem.
3. Run the project on an iOS 5 or 6 device or in the simulator for iOS 5 or 6 to observe normal, expected behavior.
4. If you uncomment the code at lines 91 - 98 of AnimatedPathViewController.m, and comment out lines 102 - 111, you will see the same behavior using two CAKeyframeAnimations.

Expected Results:
I expected to see the path and the image animate together, in sync, along the entire path.

Actual Results:
The path drawing and image do not keep together during the animation. NOTE THIS ONLY OCCURS IN iOS 7. For iOS 5 and iOS 6, it works as expected.

Version:
iOS 7.0 and above.

Notes:
I have not found a workaround, but am starting to try using CADisplayLink and manually setting the progress of the animations, synced to the refresh of the display.


Configuration:
This error occurs only in iOS 7, on both a device and in the simulator.

Attachments:
'AnimatedPaths-stevekohls.zip' was successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!