1 回答

TA貢獻1794條經驗 獲得超8個贊
解決方案是使用 JQuery 更改圓半徑。在所有瀏覽器上的工作方式相同,不需要額外的插件。我還嘗試了 GSAP3 - 存在變換原點問題,以及 Snap.svg - 盡管它也會影響半徑屬性,但它在 IE/Edge 上不起作用。示例位于上面列出的 Codepen 鏈接上。
//Change radius to zero
function scale() {
if($('.map-circle').length) {
$('.map-circle')
.animate(
{'radius': 0},
{
step: function (radius) {
$(this).attr('r', radius);
},
duration: 800
}
);
}
}
//Change radius to initial size - 35.5
function pulse() {
if($('.map-circle').length) {
$('.map-circle')
.animate(
{'radius': 35.5},
{
step: function (radius) {
$(this).attr('r', radius);
},
duration: 1200
}
);
}
}
// Infinite animation
function animation() {
setInterval(
function () {
pulse();
scale();
}, 1000);
}
animation();
- 1 回答
- 0 關注
- 155 瀏覽
添加回答
舉報