manubb / Leaflet.PixiOverlay

Bring Pixi.js power to Leaflet maps
MIT License
463 stars 85 forks source link

Pixi Ticker availability #13

Closed icithis closed 6 years ago

icithis commented 6 years ago

I noticed there are methods for getContainer, getRenderer, etc. However if I want to animate something without map interaction (like the change in weather over time) there's no getTicker. Is there a way to add this to the project, instead of using the renderer on a loop?

manubb commented 6 years ago

I did some testing yesterday and some reflexion is needed on this to improve the API but you can try something like:

...
pixiLayer.addTo(map);

var ticker = new PIXI.ticker.Ticker();
ticker.add(function(delta) {
  markerSprites.forEach(function(markerSprite) {
    markerSprite.rotation -= 0.03 * delta;
  });
  pixiLayer.redraw();
});
ticker.start();

Anyway, can you provide a basic JSFiddle describing your usercase? That would really help me to clarify my thoughts.

icithis commented 6 years ago

The redraw functionality is sufficient, thanks for the clarification.

manubb commented 6 years ago

I have released leaflet-pixi-overlay@1.4.2 with improvement for your usercase. You can have a look at: simple-animated-markers and animated-markers for usage examples.