返回介绍

Rect.Rect

发布于 2019-12-18 15:38:23 字数 2297 浏览 979 评论 0 收藏 0

JavaScript => public Rect(x: float, y: float, width: float, height: float);
C# => public Rect(float x, float y, float width, float height);

Parameters 参数

xThe X value the rect is measured from.
矩形的x轴坐标
yThe Y value the rect is measured from.
矩形的y轴坐标
widthThe width of the rectangle.
矩形的宽
heightThe height of the rectangle.
矩形的高

Description 描述

Creates a new rectangle.
创建新的矩形。

JavaScript:

var rect = Rect (0, 0, 10, 10);

C#:

    Rect rect = new Rect(0, 0, 10, 10);

Note: Rect represents an abstract rectangle, and can be used in a variety of situations. As such, Rects don't have an explicit top, bottom, left or right. For example, Y values in Camera space are measured from the bottom of the screen, but Y values in Editor GUI space are measured from the top of the window, therefore whether the Y value of a Rect is its “top” or “bottom” will vary depending on where you use the Rect value. You can refer to the corners by using Rect.min and Rect.max.

注意:矩形代表一个抽象的矩形,可用于各种情况。因此,矩形没有一个明确的顶部、底部、左侧或右侧。在摄像机空间测量y值从屏幕的底部开始,但是在GUI编辑器空间从窗口的顶部开始测量,因此当你使用矩形的y值时,y值明确是否是它的“顶部”或者“底部”。你可以参考Rect.min和Rect.max的使用。


JavaScript =>public Rect(position: Vector2, size: Vector2);
C# =>public Rect(Vector2 position, Vector2 size);

Parameters 参数

positionThe position of the minimum corner of the rect.
sizeThe width and height of the rect.

Description

Creates a rectangle given a size and position.
创建给定大小和位置的矩形。

This form of the constructor is convenient when you are already working with Vector2 values.
当你已经用二维向量工作该构造函数是个方便的方法。

rect

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文