-
Notifications
You must be signed in to change notification settings - Fork 476
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
Refactor: Animations and values #193
Merged
Merged
Conversation
This file contains 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
- Need to rewrite the view repaint code
Now the view starts a draw loop callback independant of wether it is in continous or default mode. In the callback it checks for redrawRequests and redraws if there are any or if the drawing mode is continous.
- Implemented values API - Implemented simple animation API on top of values API - Refactored all samples
…ure we get the first redraw.
The JsiSkContourMeasureIter::next might return null and then we should just shortcut and return undefined to javascript instead of creating an object wrapping an empty object. Also refactored base class of JsiSkContourMeasure to be a SkSp wrapper Refactored use of malloc to RAII as well.
- Added animation property on value - Refactored JSI side to support this - Refactored JS side to support this
- Removed animation factory since it was only used for timing - Added decay animation - Cleaned up some demos
This is awesome, there are no other way to say it. It was quite fun to implement the imperative version of the bouncing function.
|
Review proposal for the animated value refactoring
- ReadonlyValue -> SkiaReadonlyValue - Value -> SkiaValue - Animation -> SkiaAnimation
wcandillon
approved these changes
Mar 4, 2022
Feature/animated values finalize
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.
This pull request replaces the previous animation system with a new one based on the concept of values as the state of Skia Views.
A value is a container for any value with subscription and notifications built in. There are three types of values - a regular container value, a derived (calculated value, depending on other values) and a timestamp value (updated with number of milliseconds elapsed since started).
These values are implemented in C++ and should be performant:
A new animation system is built upon this, where the SkiaDrawView repaints when a dependant value is changed. The dependencies are set in the Canvas object as an effect traversing all children and child properties.
I've also refactored the repaint algorithm in the SkiaDrawView now - so it always hooks into the display link / choreographer and checks if there are any repaint requests on every notification. This makes for a smoother repaint and also avoid repainting more often than the display refresh allows.
This PR also fixes the velocity in the
useTouchHandler
which is now returned with the correct sign and uses points pr. second, not pixels pr. secondFixes #195
Fixes #201
Implements #87