-
Notifications
You must be signed in to change notification settings - Fork 1
/
bullet01.html
38 lines (35 loc) · 1.16 KB
/
bullet01.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!--
Author: Josh Gillham
Version: 10-15-12
Descriptio:
Draws an bullet image onto the canvas and moves it acrossed the screen.
Ensure that bullet.bmp is in the same folder.
-->
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Moving Bullet</title>
<!-- Load Paper.js libray -->
<script type="text/javascript" src="paper.js"></script>
<!-- Start Paperscript -->
<script type="text/paperscript" canvas="myCanvas">
// Load the apple image
var img= new Raster( 'bullet' );
// Put it in the center of the canvas
img.position= view.bounds.center;
// Called every 1/60th of a second.
function onFrame( ) {
// Move the bullet along the angle of 0.5 and speed of 2.
img.position+= new Point( { angle: .5, length: 2 } );
}
</script>
</head>
<body>
Shows a bullet moving acrossed the screen.<br>
<!-- Link the canvas -->
<canvas id="myCanvas" resize=""></canvas>
<!-- Embed the image resource -->
<img style="width: 32px; height: 32px; Display: none;" alt="" src="bullet.bmp" id="bullet">
</body>
</html>