Cover
Reference
Tutorials
Bugs
# Click within the image and press the left and right mouse
# buttons to change the value of the rectangle
draw <- function() {
rect(25, 25, 50, 50)
}
mousePressed <- function() {
if (mouseButtonVar == LEFT) {
fill(0)
} else if (mouseButtonVar == RIGHT) {
fill(255)
} else {
fill(126)
}
}
# Click within the image and press the left and right mouse
# buttons to change the value of the rectangle
draw <- function() {
if (mousePressedVar && (mouseButtonVar == LEFT)) {
fill(0)
} else if (mousePressedVar && (mouseButtonVar == RIGHT)) {
fill(255)
} else {
fill(126)
}
rect(25, 25, 50, 50)
}