Repository navigation
perf: cap animated polylines at 30 fps - #108
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
|
Fixed a web throttle edge case: the cycle could reset on a skipped redraw, leaving a short trail frozen before the endpoint during the loop delay. The throttle now runs before the cycle reset.
All 12 tests and typecheck pass. No native builds or device tests run. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Animated polylines redrew the route on every display frame. On iOS the animator's
CADisplayLinkhad no frame-rate limit, so on ProMotion iPhones, in apps that setCADisableMinimumFrameDurationOnPhone, it rebuilt the path and gradient spans up to 120 times a second. Each rebuild makes the Google map render a frame. On an iPhone Air, in a Release build of a test app that animates a route the way Lugg's consumer app does (1250 ms,easeInOut,trailLength1, two-color gradient), the animated route alone used half a core:Every animator now redraws at most 30 times a second:
preferredFrameRateRange, and progress advances by the real time between ticks.CADisplayLink.durationstays the display's refresh interval when the link runs slower than the display, so stepping by it would have slowed the animation. The step is clamped to 0.1 s and resets on pause and resume, so a stall or a drag doesn't jump the trail.PolylineAnimator(60 fps, added for CONSUMER-APP-44Y) drops to 30 fps. Progress was already time-based throughValueAnimator.requestAnimationFrameloop skips redraws closer than 32 ms apart. Progress was already time-based.The animation's timing and the
animatedOptionsAPI don't change, only how often the line redraws. On iOS the cap iskPolylineAnimationFrameRateinPolylineAnimatorBase.h. The measurements are iOS only; Android and web weren't measured on hardware, and the change there lines them up with iOS.