## `Vec2` 类型

### Details

meta description

meta description

meta description

meta description

meta description

meta description

#### 方法

meta description

##### set

meta description

###### 参数列表
• `newValue` Vec2 !#en new value to set. !#zh 要设置的新值
##### equals

meta description

###### 参数列表
• `other` Vec2

meta description

##### lerp

meta description

###### 参数列表
• `to` Vec2
• `ratio` number the interpolation coefficient
• `out` Vec2 optional, the receiving vector

meta description

###### 参数列表
• `vector` Vec2
##### 示例
``````var v = cc.v2(10, 10);
v.addSelf(cc.v2(5, 5));// return Vec2 {x: 15, y: 15};
``````

meta description

###### 参数列表
• `vector` Vec2
• `out` Vec2 optional, the receiving vector
##### 示例
``````var v = cc.v2(10, 10);
v.add(cc.v2(5, 5));      // return Vec2 {x: 15, y: 15};
var v1;
v.add(cc.v2(5, 5), v1);  // return Vec2 {x: 15, y: 15};
``````
##### subSelf

meta description

###### 参数列表
• `vector` Vec2
##### 示例
``````var v = cc.v2(10, 10);
v.subSelf(cc.v2(5, 5));// return Vec2 {x: 5, y: 5};
``````
##### sub

meta description

###### 参数列表
• `vector` Vec2
• `out` Vec2 optional, the receiving vector
##### 示例
``````var v = cc.v2(10, 10);
v.sub(cc.v2(5, 5));      // return Vec2 {x: 5, y: 5};
var v1;
v.sub(cc.v2(5, 5), v1);  // return Vec2 {x: 5, y: 5};
``````

meta description

##### 示例
``````var v = cc.v2(10, 10);
v.mulSelf(5);// return Vec2 {x: 50, y: 50};
``````
##### mul

meta description

###### 参数列表
• `num` number
• `out` Vec2 optional, the receiving vector
##### 示例
``````var v = cc.v2(10, 10);
v.mul(5);      // return Vec2 {x: 50, y: 50};
var v1;
v.mul(5, v1);  // return Vec2 {x: 50, y: 50};
``````
##### scaleSelf

meta description

###### 参数列表
• `vector` Vec2
##### 示例
``````var v = cc.v2(10, 10);
v.scaleSelf(cc.v2(5, 5));// return Vec2 {x: 50, y: 50};
``````
##### scale

meta description

###### 参数列表
• `vector` Vec2
• `out` Vec2 optional, the receiving vector
##### 示例
``````var v = cc.v2(10, 10);
v.scale(cc.v2(5, 5));      // return Vec2 {x: 50, y: 50};
var v1;
v.scale(cc.v2(5, 5), v1);  // return Vec2 {x: 50, y: 50};
``````
##### divSelf

meta description

###### 参数列表
• `vector` Vec2
##### 示例
``````var v = cc.v2(10, 10);
v.divSelf(5); // return Vec2 {x: 2, y: 2};
``````
##### div

meta description

###### 参数列表
• `vector` Vec2
• `out` Vec2 optional, the receiving vector
##### 示例
``````var v = cc.v2(10, 10);
v.div(5);      // return Vec2 {x: 2, y: 2};
var v1;
v.div(5, v1);  // return Vec2 {x: 2, y: 2};
``````

meta description

##### 示例
``````var v = cc.v2(10, 10);
v.negSelf(); // return Vec2 {x: -10, y: -10};
``````
##### neg

meta description

###### 参数列表
• `out` Vec2 optional, the receiving vector
##### 示例
``````var v = cc.v2(10, 10);
var v1;
v.neg(v1);  // return Vec2 {x: -10, y: -10};
``````
##### dot

meta description

###### 参数列表
• `vector` Vec2
##### 示例
``````var v = cc.v2(10, 10);
v.dot(cc.v2(5, 5)); // return 100;
``````
##### cross

meta description

###### 参数列表
• `vector` Vec2
##### 示例
``````var v = cc.v2(10, 10);
v.cross(cc.v2(5, 5)); // return 0;
``````

meta description

##### 示例
``````var v = cc.v2(10, 10);
v.mag(); // return 14.142135623730951;
``````

meta description

##### 示例
``````var v = cc.v2(10, 10);
v.magSqr(); // return 200;
``````

meta description

##### 示例
``````var v = cc.v2(10, 10);
v.normalizeSelf(); // return Vec2 {x: 0.7071067811865475, y: 0.7071067811865475};
``````
##### normalize

meta description

###### 参数列表
• `out` Vec2 optional, the receiving vector
##### angle

meta description

###### 参数列表
• `vector` Vec2
##### signAngle

meta description

###### 参数列表
• `vector` Vec2
##### rotate

meta description

###### 参数列表
• `radians` number
• `out` Vec2 optional, the receiving vector
##### rotateSelf

meta description

###### 参数列表
• `radians` number