| Name | screenX |
||||||
|---|---|---|---|---|---|---|---|
| Examples |
# Move the mouse left and right to see the detail change
settings <- function() {
size(100, 100, P3D)
}
setup <- function() {
frameRate(30)
}
draw <- function() {
background(204)
x = mouseX
y = mouseY
z = -100
# Draw 'X' at z = -100
stroke(255)
line(x - 10, y - 10, z, x + 10, y + 10, z)
line(x + 10, y - 10, z, x - 10, y + 10, z)
# Draw gray line at z = 0 and same x value. Notice the parallax
stroke(102)
line(x, 0, 0, x, height, 0)
# Draw black line at z = 0 to match the x value element drawn at z
# = -100
stroke(0)
theX = screenX(x, y, z)
line(theX, 0, 0, theX, height, 0)
}
| ||||||
| Description | Takes a three-dimensional X, Y, Z position and returns the X value for where it will appear on a (two-dimensional) screen. | ||||||
| Syntax | screenX( | ||||||
| Parameters |
| ||||||
| Related |
screenY screenZ |
Cover
Reference
Tutorials
Bugs
