Skip to content

Commit bf92b97

Browse files
zenorochaeduardolundgren
authored andcommitted
decreasing the number of lines
1 parent b72b9e2 commit bf92b97

1 file changed

Lines changed: 41 additions & 45 deletions

File tree

examples/move_draw_something.html

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -65,55 +65,51 @@
6565
segment = 0,
6666
selectedElement = document.getElementById('selected');
6767

68-
videoCamera.track(
69-
{
70-
type: 'color',
71-
color: 'magenta',
72-
onFound: function(track) {
73-
if (!drawSegments[segment]) {
74-
drawSegments[segment]= [];
75-
}
76-
77-
drawSegments[segment].push(track.x, track.y);
78-
79-
if (!pencilFound) {
80-
selectedElement.className = 'pencil';
81-
}
82-
83-
pencilFound = true;
84-
},
85-
onNotFound: function() {
86-
if (pencilFound) {
87-
segment++;
88-
pencilFound = false;
89-
selectedElement.className = '';
90-
}
68+
videoCamera.track({
69+
type: 'color',
70+
color: 'magenta',
71+
onFound: function(track) {
72+
if (!drawSegments[segment]) {
73+
drawSegments[segment]= [];
74+
}
75+
76+
drawSegments[segment].push(track.x, track.y);
77+
78+
if (!pencilFound) {
79+
selectedElement.className = 'pencil';
80+
}
81+
82+
pencilFound = true;
83+
},
84+
onNotFound: function() {
85+
if (pencilFound) {
86+
segment++;
87+
pencilFound = false;
88+
selectedElement.className = '';
9189
}
9290
}
93-
);
94-
95-
videoCamera.track(
96-
{
97-
type: 'color',
98-
color: 'cyan',
99-
onFound: function(track) {
100-
segment = 0;
101-
drawSegments = [];
102-
103-
if (!eraseFound) {
104-
selectedElement.className = 'erase';
105-
}
106-
107-
eraseFound = true;
108-
},
109-
onNotFound: function() {
110-
if (eraseFound) {
111-
eraseFound = false;
112-
selectedElement.className = '';
113-
}
91+
});
92+
93+
videoCamera.track({
94+
type: 'color',
95+
color: 'cyan',
96+
onFound: function(track) {
97+
segment = 0;
98+
drawSegments = [];
99+
100+
if (!eraseFound) {
101+
selectedElement.className = 'erase';
102+
}
103+
104+
eraseFound = true;
105+
},
106+
onNotFound: function() {
107+
if (eraseFound) {
108+
eraseFound = false;
109+
selectedElement.className = '';
114110
}
115111
}
116-
);
112+
});
117113

118114
(function loop() {
119115
for (var i = 0, len = drawSegments.length; i < len; i++) {

0 commit comments

Comments
 (0)