HTML and CSS Reference
In-Depth Information
window
.
addEventListener
(
'load'
,
eventWindowLoaded
,
false
false
);
function
function
eventWindowLoaded
() {
canvasApp
();
}
function
function
canvasSupport
() {
return
return
Modernizr
.
canvas
;
}
function
function
canvasApp
() {
iif
(
!
canvasSupport
()) {
return
return
;
}
var
new
Image
();
pointImage
.
src
=
"point.png"
;
var
pointImage
=
new
function
function
drawScreen
() {
context
.
fillStyle
=
'#EEEEEE'
;
context
.
fillRect
(
0
,
0
,
theCanvas
.
width
,
theCanvas
.
height
);
//Box
context
.
strokeStyle
=
'#000000'
;
context
.
strokeRect
(
1
,
1
,
theCanvas
.
width
-
2
,
theCanvas
.
height
-
2
);
// Create ball
iif
(
moves
>
0
) {
moves
--
;
ball
.
x
+=
xunits
;
ball
.
y
+=
yunits
;
}
//Draw points to illustrate path
points
.
push
({
x
:
ball
.
x
,
y
:
ball
.
y
});
for
for
(
var
var
i
=
0
;
i
<
points
.
length
;
i
++
) {
context
.
drawImage
(
pointImage
,
points
[
i
].
x
,
points
[
i
].
y
,
1
,
1
);
}
context
.
fillStyle
=
"#000000"
;