Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CADisplayLink.targetTimestamp to drive animations #293

Open
nishant-karajgikar opened this issue Apr 23, 2021 · 4 comments
Open

Use CADisplayLink.targetTimestamp to drive animations #293

nishant-karajgikar opened this issue Apr 23, 2021 · 4 comments

Comments

@nishant-karajgikar
Copy link
Contributor

nishant-karajgikar commented Apr 23, 2021

The new flyTo implementation uses Date() directly. Which is not the most sophisticated way of handling timing in animations. We should use CADisplayLink.targetTimestamp instead.

Also applies to GestureDecelerationCameraAnimator. See #692 (comment)

Also applies to InterpolatedLocationProducer

Originally posted by @julianrex in #282 (comment)

@macdrevx macdrevx changed the title [Camera Animations] Investigate use of CACurrentMediaTime in camera animations Use of CADisplayLink.targetTimestamp to drive animations Dec 6, 2021
@macdrevx macdrevx changed the title Use of CADisplayLink.targetTimestamp to drive animations Use CADisplayLink.targetTimestamp to drive animations Dec 6, 2021
@macdrevx
Copy link
Contributor

macdrevx commented Feb 4, 2022

@macdrevx
Copy link
Contributor

macdrevx commented Feb 6, 2022

https://developer.apple.com/videos/play/wwdc2021/10147/ is also helpful.

One key takeaway is that switching to targetTimestamp isn't enough — we likely also need to use something like MTLCommandBuffer.present(_:atTime:) so that our content is drawn at the expected time when our display link is using a lower frame rate than the screen's actual refresh rate.

@macdrevx
Copy link
Contributor

macdrevx commented Feb 6, 2022

@OdNairy
Copy link
Contributor

OdNairy commented Oct 22, 2024

Still actual

let elapsedTime = dateProvider.now.timeIntervalSince(startDate)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants