html5 canvas雨点打到窗玻璃动画
html5 canvas雨点打到窗玻璃动画
HTML5下雨效果
效果预览:http://hovertree.com/texiao/html5/4.htm
1 <!doctype html> 2 <html lang="zh"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7 <title>HTML5 Canvas雨滴下落动画DEMO演示 - 何问起</title><base target="_blank" /> 8 <link rel="stylesheet" type="text/css" href="http://hovertree.com/texiao/html5/4/hovertreemalize.css" /> 9 <link rel="stylesheet" type="text/css" href="http://hovertree.com/texiao/html5/4/hovertreerain.css"> 10 <style media="screen"> 11 body { 12 overflow: hidden; 13 height: 100%; 14 margin: 0; 15 padding: 0; 16 } 17 18 img { 19 width: 100%; 20 height: 100%; 21 } 22 </style> 23 24 <script src="http://hovertree.com/texiao/html5/4/rainyday.min.js"></script> 25 <script> 26 function run() { 27 var image = document.getElementById('background'); 28 image.onload = function() { 29 var engine = new RainyDay({ 30 image: this 31 }); 32 engine.rain([ [0, 2, 200], [3, 3, 1] ], 100); 33 }; 34 image.crossOrigin = 'anonymous'; 35 image.src = 'http://hovertree.com/texiao/html5/4/hovertree3.jpg'; 36 } 37 </script> 38 39 <!--[if IE]> 40 <script src="http://hovertree.com/texiao/html5/4/html5shiv.min.js"></script> 41 <![endif]--> 42 43 </head> 44 <body onLoad="run();"> 45 46 <header class="htmleaf-header"> 47 <div class="htmleaf-demo center"> 48 <a href="http://hovertree.com">何问起</a> 49 <a href="http://www.baidu.com/baidu?word=%E5%A4%A9%E6%B0%94+&ie=utf-8&tn=bds&cl=3&ct=2097152&si=hovertree.com&s=hovertree.com" class="current">天气预报</a> 50 <a href="http://hovertree.com/texiao/">特效</a> 51 <a href="http://hovertree.com/hvtart/bjae/a6w6e2qg.htm">原文</a> 52 <br />下雨了,记得收衣服关窗户,出门带雨伞 53 </div> 54 </header> 55 56 <img id="background" alt="background" src="" /> 57 58 </body> 59 </html>