xxxxxxxxxx
54
//declare varibale with "let", global variable you can reference everywere
let x = 58
function setup() {
createCanvas(500, 600);
//how to make the x,y as the center of the rectangle
//command+/ to grey out chunks of line
rectMode(CENTER);
}
function draw() {
//conditional statement: if(){}
//"width"= width of our canvas
if(mouseX > width/2 && mouseY > height/2){
print("hahahah you are in my mouth");
}
//for color, type in RGB color value between 0~250.
background(200,100,100);
strokeWeight(10);
line(100,300,200,140);
line(300,100,480,400);
//noFill is transparet shape
rect(350,400,mouseY,mouseX);
//reads as cascading, objects that comes after are laid on top of previous objects
//fourth number in fill is transparency
stroke(250);
strokeWeight(10);
fill(120,200,100,230);
ellipse(mouseX-150,300,130,130);
fill(220,100,100)
ellipse(mouseX,300,130,130);
//stroke is color of outline, strokeWeight=thickness in pixels
strokeWeight(30)
point(220, 300);
point(380, 300);
print(mouseX);
}
//tips: type out structure before filling in with arguments