mapshakers / leaflet-icon-pulse

Leaflet pulsing icon plugin.
MIT License
207 stars 69 forks source link

pulse for a limited duration #5

Open derekeder opened 8 years ago

derekeder commented 8 years ago

Would it be possible to add a setting that stops the pulse animation after a number of seconds?

Something like:

var pulsingIcon = L.icon.pulse({iconSize:[20,20],color:'red', pulseDuration: 5});
thomaslwk commented 7 years ago

Hi , if anyone is still interested you can edit this part in "L.Icon.Pulse.js" file.
Line 21 - animation-iteration-count defaults to infinite, you can change count to number of pulses you would like before the pulsing animation stops. ` var after = [

            'box-shadow: 0 0 6px 2px '+this.options.color,

            'animation: pulsate ' + this.options.heartbeat + 's ease-out',
            'animation-iteration-count: 1',
            'animation-delay: '+ (this.options.heartbeat + .1) + 's',
        ];

`