## `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

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

##### 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};
``````
##### contain

meta description

###### 参数列表
• `a` Rect Rect a
• `b` Rect Rect b
##### 示例
``````var a = new cc.Rect(0, 0, 10, 10);
var b = new cc.Rect(5, 5, 5, 5);
var c = new cc.Rect(20, 20, 10, 10);
cc.Rect.contain(a, b); //  1;
cc.Rect.contain(b, a); // -1;
cc.Rect.contain(a, c); //  0;
``````

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);
}
``````

meta description

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

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

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

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