-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpointcloud.js
More file actions
31 lines (28 loc) · 732 Bytes
/
pointcloud.js
File metadata and controls
31 lines (28 loc) · 732 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
let WINDOW_WIDTH = 640;
let WINDOW_HEIGHT = 480;
window.addEventListener('DOMContentLoaded', (event) => {
draw();
});
class Point {
constructor() {
this.x = Math.random() * WINDOW_WIDTH;
this.y = Math.random() * WINDOW_HEIGHT;
this.v = Math.random() * 360;
}
}
function draw() {
var elem = document.getElementById('draw-shapes');
var two = new Two({ width: WINDOW_WIDTH, height: WINDOW_HEIGHT }).appendTo(elem);
let points = [];
for (var i = 0; i < 5; i++) {
points.push(new Point());
}
console.log(points);
two.bind('update', function(frameCount) {
for (var i = 0; i < points.length; i++) {
let dot = two.makeCircle(points[i].x, points[i].y, 5);
dot.fill = 'black';
dot.noStroke();
}
}).play();
}