Animated" ImageOverlay

39 views
Skip to first unread message

devque...@gmail.com

unread,
Mar 21, 2017, 2:28:55 PM3/21/17
to Leaflet
Is there any way to loop over a set of images on a leaflet map ? 

I tried using opacity, but it does not really work.

Arnie Shore

unread,
Mar 21, 2017, 2:35:47 PM3/21/17
to leafl...@googlegroups.com
That's not quite clear. 

Like these images, are they leaflet objects?  And in that loop, do exactly what,?

On Tue, Mar 21, 2017 at 2:28 PM, <devque...@gmail.com> wrote:
Is there any way to loop over a set of images on a leaflet map ? 

I tried using opacity, but it does not really work.

--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

devque...@gmail.com

unread,
Mar 21, 2017, 2:47:03 PM3/21/17
to Leaflet
Hi,

Thanks for the reply. Apologies for being unclear.

I have a map with CRS.Simple co-ordinates along with an image overlay. here is  the code. 


var map2 = L.map('map2', {
crs : L.CRS.Simple,
minZoom : -5,
boxZoom : true
});

var bounds = [ [ 0, 0 ], [ 10, 10 ] ];
var img = '../images/img1.jpg'
var image = L.imageOverlay(img, bounds).addTo(map2);
map2.fitBounds(bounds);

Instead of a single image, I want to show a series of images that animate. For instance show 
img1, img2 and img3 each in such a way that it gives an impression of a movie. So may be loop over img1 img2 and img3 with 2 sec delay or something.


Thanks again for the reply. 












On Tuesday, March 21, 2017 at 2:35:47 PM UTC-4, Arnie Shore wrote:
That's not quite clear. 

Like these images, are they leaflet objects?  And in that loop, do exactly what,?
On Tue, Mar 21, 2017 at 2:28 PM, <devque...@gmail.com> wrote:
Is there any way to loop over a set of images on a leaflet map ? 

I tried using opacity, but it does not really work.

--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.

devque...@gmail.com

unread,
Apr 4, 2017, 11:27:18 AM4/4/17
to Leaflet
okay , here is how I got it working 


Added multiple overlay images and set the opacity of all the images to 0 except 1 in a loop with timer. It works fine. You must put this code in a function and call it using  setTimeOut()
.  If anybody is interested , i will post the complete working code.

Here is a code snippet

for (k = 0; k < overlays.length; k++) {
if (k == current_k) {
overlays[k].setOpacity(1);
} else
overlays[k].setOpacity(0);

}
map.doubleClickZoom.disable();
map.once('click', function(e) {
//map.doubleClickZoom.enable()
})
Reply all
Reply to author
Forward
0 new messages