xxxxxxxxxx
47
function setup() { //single instance
//setting canvas
var i = 0;
createCanvas(600, 400);
//mousePressPrint();
}
function draw() { //loops 30 fps
// background(color)
// one arg = greyscale
// two arg = greyscale + alpha
// three arg = rgb
// four arg = rgba
// one html color name/hex as a string - "limegreen"
// background(127, 255, 0, 50) //8 bits = 256 values - 0
background("limegreen");
noStroke();
fill(100, 100, 255);
rect(100, 100, 400, 200);
fill(200, 40, 200);
ellipse(width/2, height/2, 60); // ellipse(xloc, yloc, weight, [height])
// line(x1, y1, x2, y2)
// one pixel wide - no fill
stroke(255, 255, 0);
strokeWeight(6);
line(100, 100, 500, 300);
arc(width/2, 100, 100, 100, PI, HALF_PI);
}
function mousePressPrint()
{
var i = 0;
while (i < 10)
{
if (mouseIsPressed)
{
print(mouseX, movedY);
i++;
}
}
}