HTML and CSS Reference
In-Depth Information
//image
context
.
globalAlpha
=
.
25
;
context
.
drawImage
(
helloWorldImage
,
0
,
0
);
iif
(
fadeIn
) {
alpha
+=
.
01
;
iif
(
alpha
>=
1
) {
alpha
=
1
;
fadeIn
=
false
false
;
}
}
else
else
{
alpha
-=
.
01
;
iif
(
alpha
<
0
) {
alpha
=
0
;
fadeIn
=
true
true
;
}
}
//text
context
.
font
=
"72px Sans-Serif"
;
context
.
textBaseline
=
"top"
;
context
.
globalAlpha
=
alpha
;
context
.
fillStyle
=
"#FFFFFF"
;
context
.
fillText
(
text
,
150
,
200
);
}
var
var
text
=
"Hello World"
;
var
var
alpha
=
0
;
var
var
fadeIn
=
true
true
;
//image
var
var
helloWorldImage
=
new
new
Image
();
helloWorldImage
.
src
=
"html5bg.jpg"
;
function
function
gameLoop
() {
window
.
setTimeout
(
gameLoop
,
20
);
drawScreen
()
}
gameLoop
();
}