作者oasisrose (life goes on)
看板Web_Design
标题[讨论] Google Maps程式码
时间Thu Mar 31 04:09:16 2016
https://developers.google.com/maps/documentation/javascript/markers#animate
想请问下面这行程式码要如何理解呢?(黄标处)
function toggleBounce() {
if (marker.getAnimation() !== null) {
marker.setAnimation(null);
} else {
marker.setAnimation(google.maps.Animation.BOUNCE);
}
}
ps. 文件说明:
BOUNCE 指出标记在原地弹跳。
弹跳标记会持续弹跳,直到它的 animation 属性明确设成 null 才会停止。
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 219.84.234.215
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Web_Design/M.1459368560.A.DC2.html
1F:→ Rinorune: 如果marker.getAnimation()的回传值不等於null 03/31 14:51
2F:→ Rinorune: 应该是指 maker.animation !== null 03/31 14:52
3F:→ Rinorune: 即是判断marker.animation是否为null(有没有东西) 03/31 14:54
4F:推 arjuna: 本来在跳的变成不跳,不跳的让他开始跳 03/31 15:04
5F:推 shter: 如果有值(!==null)就把它设成null 04/01 01:20
6F:→ oasisrose: 谢谢大家,web板真温馨 04/01 03:00
7F:推 yyc1217: 可以理解为hasAnimation()或isAnimated()吧 04/01 17:03
8F:推 rarex: 看function name嘛~toggle就是on->off off->on 04/01 21:08