-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLog.js
More file actions
27 lines (27 loc) · 698 Bytes
/
Copy pathLog.js
File metadata and controls
27 lines (27 loc) · 698 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
class Log {
constructor(x, y, height, angle) {
var options = {
'restitution':0.8,
'friction':1.0,
'density':1.0
}
this.body = Bodies.rectangle(x, y, 20, height, options);
this.width = 20;
this.height = height;
Matter.Body.setAngle(this.body, angle);
World.add(world, this.body);
}
display(){
var pos =this.body.position;
var angle = this.body.angle;
push();
translate(pos.x, pos.y);
rotate(angle);
rectMode(CENTER);
//strokeWeight(4);
//stroke("green");
fill("blue");
rect(0, 0, this.width, this.height);
pop();
}
};