CSS3中利用animation属性创建雪花飘落特效

2020-05-10 13:25:12易采站长站整理

div.className=”div”;
document.getElementById(“snowzone”).appendChild(div);
setTimeout(function(){
document.getElementById(“snowzone”).removeChild(div);
// console.log(window.innerHeight);
},5000);
}
setInterval(function(){
var left = Math.random()*window.innerWidth;
var height = Math.random()*window.innerHeight;
var src = “s”+Math.floor(Math.random()*2+1)+”.png”;//两张图片分别为”s1.png”、”s2.png”
snow(left,height,src);
},500);
})();
</script>
</html>

两张雪花图片:
 
最终效果: