Add Initial commit
This commit is contained in:
19
CM2030 Graphics Programming/Topic 2/2.2.1/sketch.js
Normal file
19
CM2030 Graphics Programming/Topic 2/2.2.1/sketch.js
Normal file
@ -0,0 +1,19 @@
|
||||
function setup() {
|
||||
createCanvas(900, 600);
|
||||
background(0);
|
||||
}
|
||||
|
||||
function draw()
|
||||
{
|
||||
background(125);
|
||||
|
||||
let mouse = createVector(mouseX, mouseY);
|
||||
let center = createVector(width/2, height/2);
|
||||
|
||||
mouse.sub(center);
|
||||
|
||||
translate(width/2, height/2);
|
||||
strokeWeight(3);
|
||||
|
||||
line(0, 0, mouse.x, mouse.y);
|
||||
}
|
||||
Reference in New Issue
Block a user