Git Product home page Git Product logo

Comments (4)

atogle avatar atogle commented on September 23, 2024

Thanks @nhinze. That's a really interesting idea. I'll try to carve out some time for it. I'm happy to help out with questions if you want to take a stab at it.

from leaflet.animatedmarker.

nhinze avatar nhinze commented on September 23, 2024

I added a little pull request that shows how I edited your code to send the distance travelled to a custom function at each interval. However, something cleaner would be nice. I'm not very familiar with leaflet yet.

from leaflet.animatedmarker.

atogle avatar atogle commented on September 23, 2024

Thank @nhinze. I glanced at it and I think there's probably a better way to tackle it. Your solution calls the callback at each vertex which could end up being less an ideal if you have a line that's 100 miles long but only a start and end point, for example. You'd only get callbacks on start and finish.

@mourner recommended that I check out the new DomPosition util to implement the animation. There might be something in there to help.

Again, thanks for the idea and the code ideas. Much appreciated!

from leaflet.animatedmarker.

nhinze avatar nhinze commented on September 23, 2024

Actually, the hack I did calls the function at minimum at each "interval". I have it set at 1000 ms, so I get a position/distance update at least every 1s. However, I do agree that my hack is a dirty solution and there is probably a better way.

from leaflet.animatedmarker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.