简体   繁体   中英

Marker Animation on polylines in primefaces JSF

I want to show moving marker along polyline in gmap of Primefaces. Does gmap supports marker animation along polyline? I have searched but did not find any useful link.

I think you want this animation on polyline with Primefaces GMap Polyline . If yes then you can achieve this by getting Polyline Object in JavaScript and then just pass that object to GMap mentioned example (animation on polyline).

function initMap(){
    var gmap = PF('gmap').getMap();                             
    var line = gmap.polylines[0];              
    animateCircle(line);
}
function animateCircle(line) {
      var count = 0;
      window.setInterval(function() {
        count = (count + 1) % 200;

        var icons = line.get('icons');
        icons[0].offset = (count / 2) + '%';
        line.set('icons', icons);
    }, 20);
  }

Just call javascript funtion from your code. Hopefully this will help someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM