rubenspgcavalcante/leaflet-ant-path

Is it possible to have animations with canvas ?

kamilcglr opened this issue · 0 comments

Type:

  • question

Description:
Hello, I would like to animate several paths on my map. So it seems the performance are better with canvas.

However, when I put a custom renderer, the paths are displayed but the animation does not work anymore.

I set the preferCanvas option to true for the map.

this.$refs.sensorMap.mapObject.createPane('customPane')
this.canvasRenderer = this.$L.canvas({ pane: 'customPane' })

const antPolyline = this.$L.polyline.antPath(
          [
            'M',
            [this.originLatitude, this.originLongitude],
            'Q',
            midpointLatLng,
            [latitude, longitude],
          ],
          {
            use: this.$L.curve,
            delay: 500,
            dashArray: [50, 10],
            weight: this.getWeight(item.data),
            color: this.getColor(item.dir),
            pulseColor: '#FFFFFF',
            hardwareAcceleration: true,
            interactive: false,
            reverse: item.dir === 'IN',
            renderer: this.canvasRenderer, <= this option breaks animations
          }
        )

The lines are drawn but the animations do not work anymore. Is it possible to have the animations using a canvas renderer?
Thank you in advance