代码部分:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>1.3 下雨效果</title>
<style>
canvas { position: absolute; z-index: 10; top: 0; left: 0; opacity: 0.5; }
</style>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
var W = $(window).width(),
H = $(window).height(),
x2 = -15, len = 30, count = 100;
var canvas = document.getElementById("snow");
canvas.width = W;
canvas.height = H;
var ctx = canvas.getContext('2d');
setInterval(clearCanvas,1