## `Rect` 类型

### Details

meta description

meta description

meta description

meta description

meta description

meta description

meta description

meta description

meta description

meta description

meta description

#### 方法

##### constructor

Rect类的构造函数。可以通过 cc.rect 简便方法进行创建。

meta description

##### fromMinMax

meta description

###### 参数列表
• `v1` Vec2
• `v2` Vec2
##### 示例
``````cc.Rect.fromMinMax(cc.v2(10, 10), cc.v2(20, 20)); // Rect {x: 10, y: 10, width: 10, height: 10};
``````

meta description

##### 示例
``````var a = new cc.Rect(0, 0, 10, 10);
a.clone();// Rect {x: 0, y: 0, width: 10, height: 10}
``````
##### equals

meta description

###### 参数列表
• `other` Rect
##### 示例
``````var a = new cc.Rect(0, 0, 10, 10);
var b = new cc.Rect(0, 0, 10, 10);
a.equals(b);// true;
``````
##### lerp

meta description

###### 参数列表
• `to` Rect
• `ratio` Number the interpolation coefficient.
• `out` Rect optional, the receiving vector.
##### 示例
``````var a = new cc.Rect(0, 0, 10, 10);
var b = new cc.Rect(50, 50, 100, 100);
update (dt) {
// method 1;
var c = a.lerp(b, dt * 0.1);
// method 2;
a.lerp(b, dt * 0.1, c);
}
``````
##### intersects

meta description

###### 参数列表
• `rect` Rect
##### 示例
``````var a = new cc.Rect(0, 0, 10, 10);
var b = new cc.Rect(0, 0, 20, 20);
a.intersects(b);// true
``````
##### intersection

meta description

###### 参数列表
• `out` Rect Stores the result
• `rectB` Rect
##### 示例
``````var a = new cc.Rect(0, 10, 20, 20);
var b = new cc.Rect(0, 10, 10, 10);
var intersection = new cc.Rect();
a.intersection(intersection, b); // intersection {x: 0, y: 10, width: 10, height: 10};
``````
##### contains

meta description

###### 参数列表
• `point` Vec2
##### 示例
``````var a = new cc.Rect(0, 0, 10, 10);
var b = new cc.Vec2(0, 5);
a.contains(b);// true
``````
##### containsRect

meta description

###### 参数列表
• `rect` Rect
##### 示例
``````var a = new cc.Rect(0, 0, 20, 20);
var b = new cc.Rect(0, 0, 10, 10);
a.containsRect(b);// true
``````
##### union

meta description

###### 参数列表
• `out` Rect Stores the result
• `rectB` Rect
##### 示例
``````var a = new cc.Rect(0, 10, 20, 20);
var b = new cc.Rect(0, 10, 10, 10);
var union = new cc.Rect();
a.union(union, b); // union {x: 0, y: 10, width: 20, height: 20};
``````
##### transformMat4

meta description

###### 参数列表
• `out` Rect The output rect
• `mat` Mat4 The matrix4

meta description

##### 示例
``````var a = new cc.Rect(0, 0, 10, 10);
a.toString();// "(0.00, 0.00, 10.00, 10.00)";
``````
##### set

meta description

###### 参数列表
• `source` ValueType the source to copy