-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
62 lines (55 loc) · 1.26 KB
/
index.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
<html>
<body>
<canvas></canvas>
<script src="build/build.js"></script>
<script>
var convolve = require('convolve');
var canvas = document.querySelector('canvas');
var ctx = canvas.getContext('2d');
var img = new Image;
img.onload = draw;
img.src = 'maru.jpg';
var sharpen = [
[-1, -1, -1],
[-1, 9, -1],
[-1, -1, -1]
];
var blur = [
[0, .2, 0],
[.2, .2, .2],
[0, .2, 0],
];
// factor 1 / 13
var blurMore = [
[0, 0, 1, 0, 0],
[0, 1, 1, 1, 0],
[1, 1, 1, 1, 1],
[0, 1, 1, 1, 0],
[0, 0, 1, 0, 0]
];
// factor 1 / 7
var motionBlur = [
[1, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 1]
];
var edges = [
[0, -1, 0],
[-1, 4, -1],
[0, -1, 0]
];
function draw() {
canvas.width = img.width;
canvas.height = img.height;
ctx.drawImage(img, 0, 0);
convolve(blurMore)
.factor(1 / 13)
.canvas(canvas);
}
</script>
</body>
</html>