| Name | dist |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Examples |
# Sets the background gray value based on the distance of the mouse from the
# center of the screen
draw <- function() {
noStroke()
d = dist(width/2, height/2, mouseX, mouseY)
maxDist = dist(0, 0, width/2, height/2)
gray = map(d, 0, maxDist, 0, 255)
fill(gray)
rect(0, 0, width, height)
}
| ||||||||||||
| Description | Calculates the distance between two points. | ||||||||||||
| Syntax | dist( | ||||||||||||
| Parameters |
|
Cover
Reference
Tutorials
Bugs
