cc.Vec2
- cc.Vec2 二维向量坐标, 表结构{x: 120, y: 120}; cc.v2(x, y) 创建一个二维向量 cc.p() 创建一个二外向量
- cc.pSub: 向量相减
- cc.pAdd: 向量相加;
- cc.pLength: 向量长度;
//坐标位置3种方法--1
var w_pos = new cc.Vec2(100,100);
console.log(w_pos);
//坐标位置3种方法--2
w_pos = cc.v2(200,200);
console.log(w_pos);
//坐标位置3种方法--3
w_pos = cc.p(300,300);
console.log(w_pos);
//向量:cc.pAdd: 向量相加
var src = cc.v2(0,0);
var dst = cc.v2(100,100);
var dir = dst.sub(src);//向量相减
var len = dir.mag();//pLength向量长度
console.log(len);
//cc.Size
var s = new cc.Size(100,100);
console.log(s);
s = cc.size(200,200);
console.log(s);
cc.Size/cc.Rect
- cc.Size: 包含宽度和高度信息的对象 {width: 100, height: 100};
- new cc.Size(w, h), cc.size(w, h)创建一个 大小对象;
- cc.Re