forked from konstantinos-tsatsarounos/rainyday.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo4.html
80 lines (75 loc) · 2.96 KB
/
demo4.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>rainyday.js demo #4</title>
<style media="screen">
body {
overflow: hidden;
height: 100%;
margin: 0;
padding: 0;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
color: #333;
}
img {
width: 100%;
height: 100%;
}
#infobox {
z-index: 100;
position: absolute;
top: 0;
left: 0;
}
#infobox div {
width: 260px;
padding: 15px;
background-color: #f2f2f2;
visibility: hidden;
}
#infobox:hover div {
visibility: visible;
}
</style>
<script src="rainyday.js"></script>
<script>
function run() {
var image = document.getElementById('background');
image.onload = function() {
var engine = new RainyDay({
image: this,
gravityAngle: Math.PI / 9
});
engine.trail = engine.TRAIL_SMUDGE;
engine.rain([ [1, 0, 1000], [3, 3, 1] ], 100);
};
image.crossOrigin = 'anonymous';
image.src = 'http://i.imgur.com/VuX2Nf0.jpg';
// hide info container
document.getElementById('infobox').children[0].style.visibility = 'visible';
setTimeout(function(){
// remove inline style -otherwise the hover effect would not be effective
document.getElementById('infobox').children[0].style.visibility = '';
}, 5000);
}
</script>
</head>
<body onload="run();">
<img id="background" alt="background" src="" />
<div id="infobox" >
<div>
<h1>rainyday.js</h1>
<p>A simple script for simulating raindrops falling on a glass surface.</p>
<p>For more demos and information see the <a href="http://maroslaw.github.io/rainyday.js/">project page</a>.</p>
<p>
<button onclick="document.getElementById('background').src='http://i.imgur.com/U1Tqqdw.jpg';">Dark Image</button>
<button onclick="document.getElementById('background').src='http://i.imgur.com/VuX2Nf0.jpg';">Light Image</button>
</p>
<p>
Script <a href="http://maroslaw.github.io/rainyday.js/">rainyday.js</a> by <a href="https://github.com/maroslaw">Marek Brodziak</a> licensed under <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt">GNU General Public License 2.0</a>.
</p>
</div>
</div>
</body>
</html>