-
-
Notifications
You must be signed in to change notification settings - Fork 340
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
Improve fling animation #963
Conversation
* change offset to velocity / animationTime (with some mysterious factor) * allow setting animation base time and fling threshold in UiSettings * adjust UnitBezier parameters for less sudden stop of fling animation
Neat! Could you update the android |
Sure! Did you test it? I am not 100% sure the factor 0.28 will work on all screenDensities / tilts. What else is to be done?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! Are you able to provide a video of the change in action on one of the native platforms?
Same app on Android as in #927 (comment), but with the updated library with flingAnimationBaseTime set to 300 ms and flingThreshold set to 300: ml_new.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a great cleanup. I have just one minor comment.
// factor 1000 because speed is in pixels/s | ||
// and the factor 0.28 was determined by testing: panning the map and releasing | ||
// should result in fling animation starting at same speed as the move before | ||
double offsetX = velocityX * animationTime * 0.28 / 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should 0.28 / 1000 also be a constant defined either in uiSettings or in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The factor 0.28 should be a constant, as I found just ~10-20% changed value results in the animation feeling wrong (e.g. with 0.4 the animation starts noticeably faster than the the map was moved before taking the finger off the display).
1/1000 could be some MILLISECONDS_TO_SECONDS
constant. This is used to convert animationTime to seconds (it's mapbox source but this helped me here: https://github.com/mapbox/mapbox-gestures-android/blob/master/library/src/main/java/com/mapbox/android/gestures/ProgressiveGesture.java#L82 means that velocity is computed per 1000 ms).
Hi, Thank you, |
@ysmaherzi 10.2.0 reverted 10.1.0 because it contained a breaking change and should have been a major release. Sorry for the confusion. This change will be included in the 11.0.0 release (again). |
Thank you @louwers :) |
Co-authored-by: Ovidiu Voda <ovi.voda@gmail.com>
PR for #927
This improves the fling animation with the main goal of the animation being similar to other maps.
See #927 (comment) for the reasons.
Short: