diff --git a/examples/icon-sprite-webgl.js b/examples/icon-sprite-webgl.js index 08f875e634..ab885e35d6 100644 --- a/examples/icon-sprite-webgl.js +++ b/examples/icon-sprite-webgl.js @@ -17,7 +17,7 @@ const vectorSource = new Vector({ attributions: 'National UFO Reporting Center' }); -const texture = document.createElement('img'); +const texture = new Image(); texture.src = 'data/ufo_shapes.png'; // This describes the content of the associated sprite sheet @@ -136,3 +136,7 @@ map.on('pointermove', function(evt) { info.innerText = 'On ' + datetime + ', lasted ' + duration + ' seconds and had a "' + shape + '" shape.'; }); }); + +texture.addEventListener('load', function() { + map.render(); +});