Search Phrase = variables
Keywords: variables
variables Overview Part 1
variables Overview Part 1
Click here to load this code in the P5JS Editor
Or Copy/Paste the code below into your own P5JS Editor
function setup() {
createCanvas(600, 600);
drawBox(0, 0, 30, 500); // function call to drawBox
}
function drawBox(a, b, c, d) {
// Draw a rectangle using the given parameters.
rect(a, b, c, d);
}
variables Overview Part 2
variables Overview Part 2
Below is the full source code from this demo. You can copy and paste this into P5JS or you can open it directly here.
function setup() {
createCanvas(500, 500);
myXPos = 200;
console.log("I am in the setup function an myXPos = " + myXPos);
fill("blue");
drawBox(myXPos, 200, 50, 70);
fill("red");
drawBox(myXPos+100, 0, 200, 500);
}
function drawBox (a,b,c,d) {
console.log ("I am in the drawBox function and myXPos = " + a);
rect(a,b,c,d);
}
variables Overview Part 3
Below is the full source code from this demo. You can copy and paste this into P5JS or you can open it directly here.
function setup() {
createCanvas(500, 500);
myXPos = 200;
console.log("I am in the setup function an myXPos = " + myXPos);
fill("blue");
drawBox(myXPos, 200, 50, 70);
fill("red");
drawBox(myXPos+100, 0, 200, 500);
}
function drawBox (a,b,c,d) {
console.log ("I am in the drawBox function and myXPos = " + a);
rect(a,b,c,d);
}
There are no Main Site search results.