-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLog.js
More file actions
29 lines (27 loc) · 723 Bytes
/
Log.js
File metadata and controls
29 lines (27 loc) · 723 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
class Log{
constructor(x,y,height,angle){
var options = {
restitution: 1.0,
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("red");
rect(0, 0, this.width, this.height);
pop();
}
}