Add Initial commit

This commit is contained in:
Lev
2021-04-22 18:06:24 -05:00
parent 997677b12a
commit 3b3dd5a059
5 changed files with 15984 additions and 0 deletions

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>randomDot</title>
<script src="libraries/p5.min.js" type="text/javascript"></script>
<script src="libraries/p5.dom.js" type="text/javascript"></script>
<script src="libraries/p5.sound.js" type="text/javascript"></script>
<script src="sketch.js" type="text/javascript"></script>
<style> body {padding: 0; margin: 0;} canvas {vertical-align: top;} </style>
</head>
<body>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
function setup() {
createCanvas(900, 600);
background(0);
}
function draw()
{
background(125);
var mouse = createVector(mouseX, mouseY);
var center = createVector(width/2, height/2);
mouse.sub(center);
textSize(20);
// We use extract the magnitude of a vector using the p5.js .mag() function
text("Magnitude: " + mouse.mag().toFixed(2), 0, 20);
fill('white');
rect(0, 30, mouse.mag(), 10);
console.log(typeof mouse.mag())
translate(width/2, height/2);
strokeWeight(3);
line(0,0, mouse.x, mouse.y);
}