rainyday.js
效果也是够帅,设计达人中有介绍。
<style media="screen" type="text/css">
img { display: none; }
body { overflow: hidden; }
#canvas { position: absolute; top: 0px; left: 0px; }
</style>
<script src="js/rainyday.js" type="text/javascript"></script>
<script type="text/javascript">
function demo() {
var engine = new RainyDay('canvas','demo2', window.innerWidth, window.innerHeight);
engine.gravity = engine.GRAVITY_NON_LINEAR;
engine.trail = engine.TRAIL_DROPS;
engine.VARIABLE_GRAVITY_ANGLE = Math.PI / 8;
engine.rain([
engine.preset(0, 2, 0.5),
engine.preset(4, 4, 1)
], 50);
}
</script>
只需要在头部加上代码然后再body onload就可以
然而我下载的图片只能用BASE64图片编码,这跟的src一大串,还好有个在线图片转码工具:link