Created
November 11, 2012 15:11
-
-
Save zenorocha/4055187 to your computer and use it in GitHub Desktop.
tracking.js - Multiple Controller Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var videoCamera = new tracking.VideoCamera().hide().render().renderVideoCanvas(), | |
ctx = videoCamera.canvas.context; | |
var t1 = videoCamera.track({ | |
type: 'color', | |
color: 'magenta', | |
onFound: function(track) { | |
var size = 60 - track.z; | |
ctx.strokeStyle = "rgb(255,0,255)"; | |
ctx.lineWidth = 3; | |
ctx.strokeRect(track.x - size*0.5, track.y - size*0.5, size, size); | |
} | |
}); | |
var t2 = videoCamera.track({ | |
type: 'color', | |
color: 'cyan', | |
onFound: function(track) { | |
var size = 60 - track.z; | |
ctx.strokeStyle = "rgb(0,255,255)"; | |
ctx.lineWidth = 3; | |
ctx.strokeRect(track.x - size*0.5, track.y - size*0.5, size, size); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment