-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvet3.html
More file actions
24 lines (23 loc) · 815 Bytes
/
vet3.html
File metadata and controls
24 lines (23 loc) · 815 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
<html>
<head>
<title>Vector 3 - Random Vector + Mult()</title>
<script src="https://cdn.jsdelivr.net/npm/p5@1.5.0/lib/p5.min.js"></script>
<script>
function setup() {
createCanvas(400, 400);
background(0);
}
function draw() {
// background(0);
translate(width / 2, height / 2); // Translate the 'world' to the center of the canvas
// var v = createVector(random(-100, 100), random(-100, 100));
var v = p5.Vector.random2D();
// v.mult(100);
v.mult(random(50, 100));
strokeWeight(4);
stroke(255, 50);
line(0, 0, v.x, v.y);
}
</script>
</head>
</html>