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

Add initial solution to moving target problem #1245

Merged
merged 3 commits into from
Apr 5, 2022

Conversation

macdrevx
Copy link
Contributor

@macdrevx macdrevx commented Apr 5, 2022

This PR updates the DefaultViewportTransition to animate using SimpleCameraAnimator and update the animator's target camera dynamically during the animation. This approach results in arriving at exactly the right location at the end of the transition.

Before.-.Compressed.mp4
After.-.Compressed.mp4

The high-to-low and low-to-high animation spec providers are not yet tested. Those tests will be added in a subsequent PR.

Pull request checklist:

  • Write tests for all new functionality. If tests were not written, please explain why.
  • Describe the changes in this PR, especially public API changes.
  • Add a changelog entry to to bottom of the relevant section (typically the ## main heading near the top).
  • Review and agree to the Contributor License Agreement (CLA).

}

internal struct CameraOptionsComponent<T>: CameraOptionsComponentProtocol {
internal let keyPath: WritableKeyPath<CameraOptions, T?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it have to be a key path to an optional property of CameraOptions? I see that CameraOptions has everything as Optional now, but if in the future we decide to add new property that is non-optional then this will not work for those properties.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't have to be. Doing it this way allows value (on the next line) to be non-optional.

The *Options naming pattern in GL Native typically indicates a type where all of its fields are optional. You pass instances to a setter and non-nil fields are updated and any nil fields are not modified. Given that, it's probably unlikely that we'll add non-optional fields to CameraOptions in the future.

Copy link
Contributor

@evil159 evil159 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice architecture!

@macdrevx macdrevx enabled auto-merge (squash) April 5, 2022 14:26
@macdrevx macdrevx merged commit c459b65 into main Apr 5, 2022
@macdrevx macdrevx deleted the fix/moving-target/update-transition branch April 5, 2022 14:38
OdNairy pushed a commit that referenced this pull request Aug 22, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants