forked from brianchirls/Seriously.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gradientwipe.html
97 lines (83 loc) · 2.31 KB
/
gradientwipe.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
<title>Seriously.js Gradient Wipe 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: 960px;
margin: auto;
}
img {
display: none;
}
</style>
</head>
<body>
<img id="robot" src="images/robot.jpg"/>
<img id="pencils" src="images/pencils.jpg"/>
<canvas id="canvas" width="960" height="540"></canvas>
<div id="controls">
<label>Transition <input id="transition" type="range" min="0" max="1" step="0.0001" value="0"/></label>
<label>Smoothness <input id="smoothness" type="range" min="0" max="1" step="0.0001" value="0.1"/></label>
</div>
<script src="../seriously.js"></script>
<script src="../effects/seriously.gradientwipe.js"></script>
<script src="../effects/seriously.simplex.js"></script>
<script src="../effects/seriously.blend.js"></script>
<script>
(function (Seriously) {
// declare our variables
var source = document.getElementById('source'),
seriously, // the main object that holds the entire composition
gradientwipe, // gradientwipe node
ctx, grd,
reformatRobot,
reformatPencils,
blend,
target; // a wrapper object for our target canvas
seriously = new Seriously();
gradientwipe = seriously.effect('gradientwipe');
blend = seriously.effect('blend');
target = seriously.target('#canvas');
reformatRobot = seriously.transform('reformat');
reformatPencils = seriously.transform('reformat');
reformatRobot.source = '#robot';
reformatRobot.width = 960;
reformatRobot.height = 540;
reformatRobot.mode = 'cover';
reformatPencils.source = '#pencils';
reformatPencils.width = 960;
reformatPencils.height = 540;
reformatPencils.mode = 'cover';
noise = seriously.effect('simplex');
noise.width = 960;
noise.height = 540;
noise.noiseScale = [5, 5];
noise.octaves = 3;
gradientwipe.source = reformatRobot;
gradientwipe.gradient = noise;
gradientwipe.transition = '#transition';
gradientwipe.smoothness = '#smoothness';
blend.bottom = reformatPencils;
blend.top = gradientwipe;
target.source = blend;
//render
seriously.go();
}(window.Seriously));
</script>
</body>
</html>