Add Initial commit

This commit is contained in:
Lev
2021-04-22 18:15:03 -05:00
parent 3b3dd5a059
commit b5e97847b4
5 changed files with 15989 additions and 0 deletions

View File

@ -0,0 +1,32 @@
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);
let normal = mouse.copy();
textSize(20);
text("Normal: " + normal.normalize(), 20, 50);
// We extract the direction of a vector using the p5.js .normalize() function
normal = normal.mult(50);
line(10, 60, 10 + normal.x, 60 + normal.y);
fill('white');
console.log(typeof normal);
// Center line
translate(width/2, height/2);
strokeWeight(3);
line(0,0, mouse.x, mouse.y);
}