forked from konstantinos-tsatsarounos/rainyday.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo5.html
49 lines (47 loc) · 1.42 KB
/
demo5.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>rainyday.js demo #5 (cropping)</title>
<style media="screen">
body {
overflow: hidden;
height: 100%;
margin: 0;
padding: 0;
}
#canvasHolder {
position: absolute;
top: 50px;
left: 50px;
width: 100px;
height: 100px;
}
img {
width: ;
}
</style>
<script src="rainyday.js"></script>
<script>
function run() {
var image = document.getElementById('background');
image.onload = function() {
var engine = new RainyDay({
image: this,
crop: [ 50, 50, 600, 400]
}, document.getElementById('canvas'));
engine.trail = engine.TRAIL_SMUDGE;
engine.rain([ [3, 3, 0.1] ], 33);
};
image.crossOrigin = 'anonymous';
image.src = 'http://i.imgur.com/HRtuQo8.jpg';
}
</script>
</head>
<body onload="run();">
<img id="background" alt="background" src="" />
<div id="canvasHolder">
<canvas id="canvas" width="600" height="400"></canvas>
</div>
</body>
</html>