HTML and CSS Reference
In-Depth Information
}
function
function
canvasSupport
() {
return
return
Modernizr
.
canvas
;
}
function
function
videoLoaded
(
event
) {
canvasApp
();
}
function
function
canvasApp
() {
iif
(
!
canvasSupport
()) {
return
return
;
}
function
function
drawScreen
() {
//Background
context
.
fillStyle
=
'#ffffaa'
;
context
.
fillRect
(
0
,
0
,
theCanvas
.
width
,
theCanvas
.
height
);
//Box
context
.
strokeStyle
=
'#000000'
;
context
.
strokeRect
(
5
,
5
,
theCanvas
.
width
-
10
,
theCanvas
.
height
-
10
);
//video
context
.
drawImage
(
videoElement
,
85
,
30
);
}
var
var
theCanvas
=
document
.
getElementById
(
"canvasOne"
);
var
var
context
=
theCanvas
.
getContext
(
"2d"
);
videoElement
.
play
();
function
function
gameLoop
() {
window
.
setTimeout
(
gameLoop
,
20
);
drawScreen
();
}
gameLoop
();
}
<
/script>