rotate a .gif image on google maps api v3?

前端 未结 2 1800
栀梦
栀梦 2020-11-28 13:48

I find lots of answers on this question but not one that works when using .gif images and not markers. To use .gif images (and also animated gifs) I use code (which works)<

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 14:44

    Another way to do it is to use Custom Overlay.

        .
        .
        var overlay = new google.maps.OverlayView();
        overlay.draw = function() {
            this.getPanes().markerLayer.id = 'markerLayer';
        }
        overlay.setMap(map);
        .
        .
        var deg = 270;
        document.querySelector("#markerLayer img").style.transform = 'rotate(' + deg + 'deg)';
        .
    

    See this demo pen for more clarity.

提交回复
热议问题