老规矩先来看下小构图,是不是各位看官所需要的:
主要用的到是:
模块:'dojo/_base/fx'
类:basefx
部分核心代码:
function switchbaseMap() {
var colorfullbasemapdiv = colorfullbasemap.getNode();
var graybasemapdiv = graybasemap.getNode();
if (colorfullbasemapdiv.style.display == "none") {
basefx.animateProperty({
node: graybasemapdiv,
duration:1000,
properties: { opacity: 0 },
onEnd:function(){
graybasemapdiv.style.display="none";
colorfullbasemapdiv.style.display="block";
basefx.animateProperty({
duration:1000,
node: colorfullbasemapdiv,
properties: { opacity: 1 }
}).play();
}
}).play();
}
else {
basefx.animateProperty({
node: colorfullbasemapdiv,
duration:1000,
properties: { opacity: 0 },
onEnd:function(){
colorfullbasemapdiv.style.display="none";
graybasemapdiv.style.display="block";
basefx.animateProperty({
duration:1000,
node: graybasemapdiv,
properties: { opacity: 1 }
}).play();
}
}).play();
}
}
完整的项目源码地址: