首页 > 文档 > screenY()屏幕Y坐标
2017
08-07

screenY()屏幕Y坐标

Name

screenY()屏幕Y坐标

   

Examples

void setup() {

size(100, 100, P3D);

}

 

void draw() {

background(204);

 

float x = mouseX;

float y = mouseY;

float 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);

float 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.

采用三维 xYZ 位置, 并返回它在 (two-dimensional) 屏幕上显示的 Y 值。

Syntax

screenY(x, y)

screenY(x, y, z)

Parameters

x

float: 3D x-coordinate to be mapped

 

要映射的 3D x 坐标

y

float: 3D y-coordinate to be mapped

 

要映射的 3D y坐标

z

float: 3D z-coordinate to be mapped

 

要映射的 3D z 坐标

Returns

float

Related

screenY()
screenZ()



最后编辑:
作者:卡萨布兰卡
卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。