forked from brianchirls/Seriously.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crop.html
80 lines (69 loc) · 1.84 KB
/
crop.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>
<head>
<title>Seriously.js Camera Shake Example</title>
<style type="text/css">
canvas {
display: block;
margin: auto;
border: black solid 1px;
}
#robot {
display: none;
}
input[type=range] {
width: 400px;
}
label {
display: block;
}
#controls {
width: 640px;
margin: auto;
}
</style>
</head>
<body>
<img id="robot" src="images/robot.jpg"/>
<canvas id="canvas" width="640" height="619"></canvas>
<div id="controls">
<label><input id="top" type="range" min="0" max="200" step="1" value="0"/> Top</label>
<label><input id="left" type="range" min="0" max="200" step="1" value="0"/> Left</label>
<label><input id="bottom" type="range" min="0" max="300" step="1" value="0"/> Bottom</label>
<label><input id="right" type="range" min="0" max="300" step="1" value="0"/> Right</label>
</div>
<script src="../seriously.js"></script>
<script src="../effects/seriously.crop.js"></script>
<script>
(function (Seriously) {
// declare our variables
var source = document.getElementById('source'),
seriously, // the main object that holds the entire composition
crop,
reformat,
target; // a wrapper object for our target canvas
seriously = new Seriously();
crop = seriously.effect('crop');
target = seriously.target('#canvas');
reformat = seriously.transform('reformat');
// connect all our nodes in the right order
reformat.source = '#robot';
reformat.mode = 'cover';
reformat.width = 640;
reformat.height = 619;
crop.source = reformat;
crop.top = '#top';
crop.left = '#left';
crop.bottom = '#bottom';
crop.right = '#right';
crop.on('resize', function () {
//target.width = crop.width;
//target.height = crop.height;
});
target.source = crop;
//render
seriously.go();
}(window.Seriously));
</script>
</body>
</html>