动态粒子连线背景实现:不支持IE,因为IE不支持requestAnimationFrame,需要用setInterval或者setTimeout模拟每一帧更新。
<html>
<head>
<style>
body{
margin:0;
padding: 0;
}
#cas{
width: 100%;
height: 100%;
background: #000;
}
</style>
</head>
<body>
<canvas id="cas"></canvas>
<script>
var canvas = document.getElementById("cas");
var ctx = canvas.getContext("2d");
resize();
window.onresize = resize;
function resize() {
canvas.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
canvas.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
}
var RAF = (function() {
return wind