You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
iOS: Animated image should animate at the same speed regardless of framerate
Summary:
In iOS 11, [CADisplayLink](https://developer.apple.com/documentation/quartzcore/cadisplaylink)'s frameInterval was deprecated in favor of preferredFramesPerSecond, but these two properties have different underlying assumptions.
- set frameInterval to 2 for 30fps
- set preferredFramesPerSecond to 30 for 30fps. When you use preferredFramesPerSecond, assume frameInterval is 1.
This fix ensures gifs in <Image> component will animate at same speed regardless of framerate.
Reviewed By: shergin
Differential Revision: D21414014
fbshipit-source-id: 40ab23bab1990cf65d2802830b6835f350999537
// displaylink.duration -- time interval between frames, assuming maximumFramesPerSecond
187
+
// displayLink.preferredFramesPerSecond (>= iOS 10) -- Set to 30 for displayDidRefresh to be called at 30 fps
188
+
// displayLink.frameInterval (< iOS 10) -- # of frames that must pass before each displayDidRefresh. After iOS 10, when this is set to 2, preferredFramesPerSecond becomes 30 fps.
189
+
// durationToNextRefresh -- Time interval to the next time displayDidRefresh is called
190
+
NSTimeInterval durationToNextRefresh;
187
191
if (@available(iOS 10.0, *)) {
188
-
// Per https://developer.apple.com/documentation/quartzcore/cadisplaylink
189
-
// displayLink.duration provides the amount of time between frames at the maximumFramesPerSecond
190
-
// Thus we need to calculate true duration based on preferredFramesPerSecond
0 commit comments