Name

screenY()

Examples
def setup(): 
 size(100, 100, P3D)
def draw(): 
 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 
 # y value. Notice the parallax
 stroke(102)
 line(0, y, 0, width, y, 0)
 # Draw black line at z = 0 to match 
 # the y value element drawn at z = -100 
 stroke(0)
 theY = screenY(x, y, z)
 line(0, theY, 0, width, theY, 0)
Description Takes a three-dimensional X, Y, Z position and returns the Y value for where it will appear on a (two-dimensional) screen.
Syntax
screenY(x, y)
screenY(x, y, z)
Parameters
xfloat: 3D x-coordinate to be mapped
yfloat: 3D y-coordinate to be mapped
zfloat: 3D z-coordinate to be mapped
Related screenX()
screenZ()

Updated on Tue Feb 27 14:07:12 2024.

If you see any errors or have comments, please let us know.

Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License

AltStyle によって変換されたページ (->オリジナル) /