HTML and CSS Reference
In-Depth Information
var
var
Debugger
=
function
function
() { };
Debugger
.
log
=
function
function
(
message
) {
try
try
{
console
.
log
(
message
);
}
catch
catch
(
exception
) {
return
return
;
}
}
function
function
eventWindowLoaded
() {
canvasApp
();
}
function
function
canvasSupport
() {
return
return
Modernizr
.
canvas
;
}
function
function
canvasApp
() {
iif
(
!
canvasSupport
()) {
return
return
;
}
var
var
theCanvas
=
document
.
getElementById
(
"canvasOne"
);
var
var
context
=
theCanvas
.
getContext
(
"2d"
);
Debugger
.
log
(
"Drawing Canvas"
);
function
function
drawScreen
() {
//background
context
.
fillStyle
=
"#ffffaa"
;
context
.
fillRect
(
0
,
0
,
500
,
300
);
//text
context
.
fillStyle
=
"#000000"
;
context
.
font
=
"20px Sans-Serif"
;
context
.
textBaseline
=
"top"
;
context
.
fillText
(
"Hello World!"
,
195
,
80
);
//image
var
var
helloWorldImage
=
new
new
Image
();
helloWorldImage
.
onload
=
function
function
() {
context
.
drawImage
(
helloWorldImage
,
155
,
110
);
}
helloWorldImage
.
src
=
"helloworld.gif"
;