-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
50 lines (41 loc) · 1.66 KB
/
index.html
File metadata and controls
50 lines (41 loc) · 1.66 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<title>PhysicsJS</title>
<link rel="stylesheet" type="text/css" href="src/style/world.css">
<link rel="stylesheet" type="text/css" href="src/style/actor.css">
</head>
<body>
<!-- Initial point of scene -->
<script type="text/javascript" src="src/abstract/vector.js"></script>
<script type="text/javascript" src="src/abstract/world.js"></script>
<script type="text/javascript">
var GRAVITY = new Vector(0, -10);
var BOUNDERIES = [ 200, -200, 200, -200 ];
var WORLD = new World(GRAVITY, BOUNDERIES);
</script>
<!-- Renderers -->
<script type="text/javascript" src="src/renderers/world.js"></script>
<script type="text/javascript" src="src/renderers/actor.js"></script>
<!-- Abstract data types and data holders -->
<script type="text/javascript" src="src/abstract/mass.js"></script>
<script type="text/javascript" src="src/abstract/actor.js"></script>
<!-- Custom play -->
<script type="text/javascript">
// define a new force - hand push - constant force
var handPush = new Vector(0, 3);
// another force that lasts 5 miliseconds
var anotherForce = new Vector(1, 0, 1);
// mass, 1000gram = 1kg
var mass = new Mass(1000, 'g');
// new "Actor" - atom
var actor = new Actor("player", mass, [handPush, anotherForce], [-70, 0], [0, 0], [0, 0]);
actor.run(function() { }, 1); // run the actor movement per 1 milisecond
// another force for new actir
var push = new Vector(0, 10.5, 1);
// new actor with the same mass
var actor2 = new Actor("player2", mass, [push], [10, 20], [0, 0], [0, 0]);
actor2.run(function() { }, 1) // observe scene per 1 milisecond
</script>
</body>
</html>