Closed Farrukh1198 closed 2 years ago
I think you need to show some code, and possibly a video or something, as it's not clear on what the problem is.
I think you need to show some code, and possibly a video or something, as it's not clear on what the problem is.
After every animation was completed there is some pause because I specified required parameter duration to 200 ms (even if I set it to 500 or 1000 ms it has interruptions). Next animation begins after that pause.
I need something like this without being interrupted
Hi there @Farrukh1198,
I was also trying to achieve this at one point, but it's very difficult to do. AFAIK, this is due to limitations with GPS. As GPS is a poll based system (not an event based one), the device must request it's location every 𝓍 seconds. Therefore, you can only animate every 𝓍 seconds, leading to starting-stopping animations like this, no matter the animation duration.
I'm not sure how other apps do it. As far as I can see in Google Maps app, the same thing happens, unless you are in navigation mode, where it somehow predicts your future movements to make it smooth. You can see this in action: say the route exits a roundabout (I live in UK where these are common) on the 3rd branch, but you make a mistake and exit on the 2nd, it takes the app a little while to notice, in which the car icon keeps going around the roundabout along the route, until the app recalculates and snaps back to your real location. I'm assuming on your second video, you used an emulator with a pre-set route. This triggers the device fake GPS to poll much quicker than usual, hence why you see this.
Perhaps if you can gauge the speed, you can predict like this, but it will never be 100% accurate. If you can find a way to make it work, I'd love to know how!
Hello @JaffaKetchup It's not about how does GPS work. It's about how does this plugin work. In the second video there are no emulators or simulations, its navigation using users current location. It's JS implementation. Now I need to do it with native tools. In JS there is no required parameter duration. In fact, GPS data arrives intermittently in less than a second. And in JS, the next animation knocks down the previous one, thereby preventing a pause between them.
Maybe leaflet is using something else behind the scenes? Also what 'duration' are you talking about?
I think this should be possible to do (but possibly not part of flutter_map internally, as I think some of it relies on gps I assume...). I'm assuming here that it's "live" (it's easy if its recorded), in which case I'm also assuming the gps is probably having a 1 second update. I'm not sure a lot of mobiles or whatever update more than that, but I may be wrong....
So assuming you are ok with a maximum of one second lag (which seems reasonable), you can interpolate between the last 2 points (or you can probably smooth it out a bit more if you are ok with slightly longer lag and variation in gps points).
Just out of interest, I have a line_animator plugin at https://github.com/ibrierley/line_animator it's not really designed for simple 2 point interpolation (it may well work ok for that though as it just interpolates through points, but I don't really have time to go into the code if it needed modifying).
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
I use animation map with Tweens. Animation controller requires duration of animation. Setting duration I get interruptions or pauses between animation. How to avoid these pauses and get smooth map moving and rotation?