forked from choi5983/magnetic_circles
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
31 lines (23 loc) · 640 Bytes
/
index.html
File metadata and controls
31 lines (23 loc) · 640 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
30
31
<html>
<head>
<title>Javascript Demo</title>
<script type="text/javascript" src="mylib.js"></script>
</head>
<body>
<div id="canvas"></div>
<script>
//create a field with 100 circles
var field = new Field(10);
console.log(field);
//draw the circles in the canvas id
field.draw_circles("canvas");
//callback function to have an invisible circle where the mouse is
document.onmousemove = function(e){
console.log(e);
field.SetCursor(e.clientX, e.clientY, 500);
}
//have calculateAccelerationAndMove method every 2ms
setInterval("field.calculateAccelerationAndMove()", 2);
</script>
</body>
</html>