forked from konstantinos-tsatsarounos/rainyday.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo1.html
56 lines (52 loc) · 1.87 KB
/
demo1.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>rainyday.js demo #1</title>
<style media="screen">
body {
overflow: hidden;
height: 100%;
margin: 0;
padding: 0;
}
img {
width: 100%;
height: 100%;
filter: blur(3px);
}
.buttons {
z-index: 1;
position: absolute;
top: 0;
left: 0;
}
</style>
<script src="rainyday.js"></script>
<script>
function run() {
var image = document.getElementById('background');
image.onload = function() {
var engine = new RainyDay({
image: this
});
engine.rain([ [1, 2, 8000] ]);
engine.rain([ [3, 3, 0.88], [5, 5, 0.9], [6, 2, 1] ], 100);
document.getElementById('pause').addEventListener('click',function(){ engine.pause(); })
document.getElementById('continue').addEventListener('click', function(){ engine.continue(); })
document.getElementById('destroy').addEventListener('click', function(){ engine.destroy(); })
};
image.crossOrigin = 'anonymous';
image.src = 'http://i.imgur.com/N7ETzFO.jpg';
}
</script>
</head>
<body onload="run();">
<img id="background" alt="background" src="" />
<div class="buttons">
<button type="button" id="pause" name="button">Pause</button>
<button type="button" id="continue" name="button">Continue</button>
<button type="button" id="destroy" name="button">Destroy</button>
</div>
</body>
</html>