forked from zenorocha/tracking.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcss_filter.html
More file actions
108 lines (99 loc) · 3.04 KB
/
Copy pathcss_filter.html
File metadata and controls
108 lines (99 loc) · 3.04 KB
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
98
99
100
101
102
103
104
105
106
107
108
<!doctype html>
<html>
<head>
<title>tracking.js - css filters</title>
<meta charset="utf-8">
<script src="../src/tracking.js"></script>
<script src="../src/tracker/color.js"></script>
<style>
* {
margin: 0;
padding: 0;
}
canvas {
-moz-transform: scale(-1, 1);
-o-transform: scale(-1, 1);
-webkit-transform: scale(-1, 1);
filter: FlipH;
transform: scale(-1, 1);
top: 0;
left: 0;
width: 100%;
height: 100%;
position: absolute;
}
.hue {
-webkit-filter: hue-rotate(328deg);
-webkit-animation: hue 3s infinite;
-moz-animation: hue 3s infinite;
-o-animation: hue 3s infinite;
animation: hue 3s infinite;
}
@-webkit-keyframes hue {
0% { -webkit-filter: hue-rotate(1deg); }
100% { -webkit-filter: hue-rotate(359deg); }
}
@-moz-keyframes hue {
0% { -webkit-filter: hue-rotate(1deg); }
100% { -webkit-filter: hue-rotate(359deg); }
}
@-o-keyframes hue {
0% { -webkit-filter: hue-rotate(1deg); }
100% { -webkit-filter: hue-rotate(359deg); }
}
@keyframes hue {
0% { -webkit-filter: hue-rotate(1deg); }
100% { -webkit-filter: hue-rotate(359deg); }
}
.invert{
-webkit-filter: invert(1);
-webkit-animation: invert 3s infinite;
-moz-animation: invert 3s infinite;
-o-animation: invert 3s infinite;
animation: invert 3s infinite;
}
@-webkit-keyframes invert {
0% , 100% { -webkit-filter: invert(0); }
50% { -webkit-filter: invert(1); }
}
@-moz-keyframes hue {
0%, 100% { -webkit-filter: invert(0); }
50% { -webkit-filter: invert(1); }
}
@-o-keyframes hue {
0% , 100% { -webkit-filter: invert(0); }
50% { -webkit-filter: invert(1); }
}
@keyframes hue {
0% , 100% { -webkit-filter: invert(0); }
50% { -webkit-filter: invert(1); }
}
</style>
</head>
<body>
<script>
var videoCamera = new tracking.VideoCamera().hide().render().renderVideoCanvas(),
canvasClassList = document.querySelector('canvas').classList;
videoCamera.track({
type: 'color',
color: 'magenta',
onFound: function(track) {
canvasClassList.add('hue');
},
onNotFound: function() {
canvasClassList.remove('hue');
}
});
videoCamera.track({
type: 'color',
color: 'cyan',
onFound: function(track) {
canvasClassList.add('invert');
},
onNotFound: function() {
canvasClassList.remove('invert');
}
});
</script>
</body>
</html>