Cover
Reference
Tutorials
Bugs
size(200, 200) value = 25 m = map(value, 0, 100, 0, width) ellipse(m, 200, 10, 10)
value = 110 m = map(value, 0, 100, -20, -10) println(m) # Prints '-9.0'
settings <- function() {
size(200, 200)
}
setup <- function() {
noStroke()
}
draw <- function() {
background(204)
x1 = map(mouseX, 0, width, 50, 150)
ellipse(x1, 75, 50, 50)
x2 = map(mouseX, 0, width, 0, 200)
ellipse(x2, 125, 50, 50)
}
map(value ,start1 ,stop1 ,start2 ,stop2 )
| value | float: the incoming value to be converted |
|---|---|
| start1 | float: lower bound of the value's current range |
| stop1 | float: upper bound of the value's current range |
| start2 | float: lower bound of the value's target range |
| stop2 | float: upper bound of the value's target range |