Mo.*_*Mo. 6 javascript google-maps css3 google-maps-api-3 css-animations
我已经构建了一个脉冲动画,CSS3我想在google maps api中实现标记,遗憾的是它无法直接插入到地图中.是否有任何CSS3动画选项或
是否可以使谷歌地图圈增加和减少动画.
var myCity = new google.maps.Circle({
center: bigOne,
radius: 150,
strokeColor: "#E16D65",
strokeWeight: 2,
fillColor: "#E16D65",
fillOpacity: 0
});
var smallcircle = new google.maps.Circle({
center: smallOne,
radius: 300,
strokeColor: "#E16D65",
strokeOpacity: 1,
strokeWeight: 2,
fillColor: "#E16D65",
fillOpacity: 0
});
Run Code Online (Sandbox Code Playgroud)
Ant*_*vić 15
您可以使用setRadius()方法更改圆半径并使用setInterval()以下命令制作动画:
var direction = 1;
var rMin = 150, rMax = 300;
setInterval(function() {
var radius = circle.getRadius();
if ((radius > rMax) || (radius < rMin)) {
direction *= -1;
}
circle.setRadius(radius + direction * 10);
}, 50);
Run Code Online (Sandbox Code Playgroud)
请参阅jsbin上的示例.
更新:缩放时的半径:您必须使用因子2更改它.请参阅jsbin上的更新示例.
| 归档时间: |
|
| 查看次数: |
7239 次 |
| 最近记录: |