Select to view content in your preferred language

pulse animation in marker same like current location

2012
1
08-16-2017 03:50 AM
chiragshah4
Emerging Contributor

I need to implement pulse animation which is currently display in current location of esrimap. I need to show this animation in marker. Is there any way to do it?

Tags (2)
1 Reply
MarkDostal
Esri Regular Contributor

Thank you for your question!  Creating a pulsing marker similar to the "current location" marker is pretty similar to the method outlined here:  Make a pulse animation in AGSPictureGraphics 

You would create a symbol using a picture marker symbol which is a blue circle, then set up a timer to vary the size.  Here's an example using a two simple marker symbol combined into an `AGSCompositeSymbol`; the size of the blue circle is changed when the timer fires:

A rough outline of the code:

    var symbolToPulse:AGSSimpleMarkerSymbol!

...

            symbolToPulse = AGSSimpleMarkerSymbol(style: .circle, color: .blue, size: 18.0)

            let sms2 = AGSSimpleMarkerSymbol(style: .circle, color: .red, size: 12.0)

            let compositeSym = AGSCompositeSymbol(symbols: [symbolToPulse, sms2])

            

            pulser = AGSGraphic(geometry: mapPoint, symbol: compositeSym, attributes: nil)

...

            timer = Timer.scheduledTimer(timeInterval: 0.1,

                                         target:self,

                                         selector: #selector(updateSize),

                                         userInfo: nil,

                                         repeats: true)

...

    let startSize: CGFloat = 18.0

    let endsize: CGFloat = 36.0

...

    func updateSize() {

        var size = symbolToPulse.size + 1.0

        if size > endsize {

            size = startSize

        }

        

        symbolToPulse.size = size

    }

Hope that helps!