# Sets the background gray value based on the distance # of the mouse from the center of the screen def draw(): 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.|
dist(x1, y1, x2, y2) dist(x1, y1, z1, x2, y2, z2)
Updated on Mon Sep 21 15:53:24 2020.
If you see any errors or have comments, please let us know.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License