-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.htm
55 lines (53 loc) · 1.55 KB
/
index.htm
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
51
52
53
54
55
<!doctype html5>
<html>
<head>
<title>Spring Crabs v1.0</title>
<style>
html, body {
width: 100%;
height: 100%;
margin: 0;
background-color: #dddddd;
}
canvas {
position: absolute;
top: 0;
left: 0;
}
</style>
<script src="vec.js" type="text/javascript"></script>
<script src="crabs.js" type="text/javascript"></script>
<script src="physics.js" type="text/javascript"></script>
<script src="renderer.js" type="text/javascript"></script>
<script src="ui.js" type="text/javascript"></script>
<script type="text/javascript">
var crabs = null
window.addEventListener('load', function() {
console.log('test')
crabs = new Crabs(document.getElementById('spring'), document.getElementById('ui'))
crabs.init()
var m1 = crabs.addMass(new Vec(50.0, 200.0), new Vec(0.0, 0.0))
var m2 = crabs.addMass(new Vec(52.0, 200.0), new Vec(0.0, 0.0))
var s1 = crabs.addSpring(m1, m2, 20.0, 0.1)
var m3 = crabs.addMass(new Vec(50.0, 500.0), new Vec(0.0, 0.0))
var m4 = crabs.addMass(new Vec(52.0, 500.0), new Vec(0.0, 0.0))
var s2 = crabs.addSpring(m3, m4, 20.0, 0.1)
var ms1 = crabs.addMuscle(s2, 30.0, 0.5, 0.0)
crabs.go()
window.addEventListener('resize', function() {
crabs.resize()
})
document.body.addEventListener('dragstart', function() {
return false
})
document.body.addEventListener('drop', function() {
return false
})
})
</script>
</head>
<body>
<canvas id="spring" style="z-index: 1;" width=1024 height=640></canvas>
<canvas id="ui" style="z-index: 2;" tabindex=1 width=1024 height=640></canvas>
</body>
</html>