The underlying data types are created uniformly through methods. New mode is no longer supported
1, coordinate cc. Point altogether 3 ways to create
Structure: {x:0,y:0}
//1 快捷创建,返回相当于cc.p(0,0)var point1 = cc.p();//2 常用var point2 = cc.p(100,100);//3 拷贝var point3 = cc.p(point2);
2, Size cc. Size altogether 3 ways to create
Structure: {width:0,height:0}
//1 快捷创建,返回相当于cc.size(0,0)var size1 = cc.size();//2 常用var size2 = cc.size(100,100);//3 拷贝var size3 = cc.size(size2);
3, regional CC. Rect altogether 3 ways to create
Structure: {x:0,y:0,width:0,height:0}
//1 快捷创建,返回相当于cc.rect(0,0,0,0)var rect1 = cc.rect();//2 常用var rect2 = cc.rect(100,100,100,100);//3 拷贝var rect3 = cc.rect(rect2);
4, Color cc. Color altogether 5 ways to create
Structure: {r:0,g:0,b:0,a:0}
//1 Quick Create, return equivalent to Cc.color (0,0,0,255); var color1 = Cc.color ();//2 Common, does not contain alpha value var Color2 = Cc.color (255,255,255);//3 commonly used, containing the alpha value var Color3 = Cc.color (255,255,255,255);//4 copy var color4 = Cc.color (color2);//5 Fixed color var color5 = cc.color.white; Common 9 fixed color types cc.color.white;//white cc.color.yellow;//yellow cc.color.blue;//Blue Cc.color.GREEN ;//green cc.color.red;//red cc.color.magenta;//magenta cc.color.black;//black cc.color.orange;//orange cc.color.gray;//gray
Reprint Please specify: http://www.douapp.com/post/2436
"COCOS2D-JS Official Documents" IV. basic data types