-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
29 lines (24 loc) · 730 Bytes
/
main.js
File metadata and controls
29 lines (24 loc) · 730 Bytes
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
window.onload = function () {
const PI = Math.PI;
var canvas = document.getElementById("canvas"),
context = canvas.getContext("2d"),
width = (canvas.width= window.innerWidth),
height = (canvas.height = window.innerHeight),
leg0= FKSystem.create(width/2, height/2),
leg1= FKSystem.create(width/2, height/2);
leg0.addArm(200, PI/2 , PI/4);
leg0.addArm(150, 0.87, 0.87);
leg1.addArm(200, PI/2 , PI/4);
leg1.addArm(150, 0.87, 0.87);
leg1.phase = PI
update();
function update()
{
context.clearRect(0,0, width, height);
leg0.update();
leg0.render(context);
leg1.update();
leg1.render(context);
requestAnimationFrame(update);
}
}