Skip to content

Commit

Permalink
fixed api docs (cocos#4918)
Browse files Browse the repository at this point in the history
* fixed api docs

* refine code

* revert change

* fixed api doc

* revert change
  • Loading branch information
2youyou2 authored and jareguo committed Jul 19, 2019
1 parent b33b14f commit f293022
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 35 deletions.
31 changes: 19 additions & 12 deletions cocos2d/actions/tween.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ let SetAction = cc.Class({
* - 支持与 cc.Action 混用
* - 支持设置 {{#crossLink "Easing"}}{{/crossLink}} 或者 progress 函数
* @class Tween
* @param {Object} target
* @param {Object} [target]
* @example
* cc.tween(node)
* .to(1, {scale: 2, position: cc.v3(100, 100, 100)})
Expand Down Expand Up @@ -263,6 +263,7 @@ Tween.prototype.clone = function (target) {
* Integrate all previous actions to an action.
* !#zh
* 将之前所有的 action 整合为一个 action。
* @method union
* @return {Tween}
*/
Tween.prototype.union = function () {
Expand Down Expand Up @@ -310,9 +311,9 @@ let actions = {
* @method to
* @param {Number} duration
* @param {Object} props - {scale: 2, position: cc.v3(100, 100, 100)}
* @param {Object} opts
* @param {Function} opts.progress
* @param {Function|String} opts.easing
* @param {Object} [opts]
* @param {Function} [opts.progress]
* @param {Function|String} [opts.easing]
* @return {Tween}
*/
to (duration, props, opts) {
Expand All @@ -329,9 +330,9 @@ let actions = {
* @method by
* @param {Number} duration
* @param {Object} props - {scale: 2, position: cc.v3(100, 100, 100)}
* @param {Object} opts
* @param {Function} opts.progress
* @param {Function|String} opts.easing
* @param {Object} [opts]
* @param {Function} [opts.progress]
* @param {Function|String} [opts.easing]
* @return {Tween}
*/
by (duration, props, opts) {
Expand Down Expand Up @@ -406,7 +407,8 @@ let actions = {
* !#zh
* 添加一个队列 action
* @method sequence
* @param {[Action|Tween]} actions
* @param {Action|Tween} action
* @param {Action|Tween} ...actions
* @return {Tween}
*/
sequence: wrapAction(cc.sequence),
Expand All @@ -416,7 +418,8 @@ let actions = {
* !#zh
* 添加一个并行 action
* @method parallel
* @param {[Action|Tween]} actions
* @param {Action|Tween} action
* @param {Action|Tween} ...actions
* @return {Tween}
*/
parallel: wrapAction(cc.spawn)
Expand All @@ -432,7 +435,7 @@ let previousAsInputActions = {
* 添加一个重复 action,这个 action 会将前一个动作作为他的参数。
* @method repeat
* @param {Number} repeatTimes
* @param {Action|Tween} [action]
* @param {Action | Tween} [action]
* @return {Tween}
*/
repeat: cc.repeat,
Expand All @@ -443,7 +446,7 @@ let previousAsInputActions = {
* !#zh
* 添加一个永久重复 action,这个 action 会将前一个动作作为他的参数。
* @method repeatForever
* @param {Action|Tween} [action]
* @param {Action | Tween} [action]
* @return {Tween}
*/
repeatForever: cc.repeatForever,
Expand All @@ -454,7 +457,7 @@ let previousAsInputActions = {
* !#zh
* 添加一个倒置时间 action,这个 action 会将前一个动作作为他的参数。
* @method reverseTime
* @param {Action|Tween} [action]
* @param {Action | Tween} [action]
* @return {Tween}
*/
reverseTime: cc.reverseTime,
Expand Down Expand Up @@ -501,6 +504,10 @@ for (let i = 0; i < keys.length; i++) {
};
}

/**
* @module cc
*/

/**
* @method tween
* @param {Object} [target] - the target to animate
Expand Down
10 changes: 5 additions & 5 deletions cocos2d/core/mesh/CCMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ let Mesh = cc.Class({
* @method init
* @param {gfx.VertexFormat} vertexFormat - vertex format
* @param {Number} vertexCount - how much vertex should be create in this buffer.
* @param {Boolean} dynamic - whether or not to use dynamic buffer.
* @param {Boolean} [dynamic] - whether or not to use dynamic buffer.
*/
init (vertexFormat, vertexCount, dynamic) {
this.clear();
Expand Down Expand Up @@ -180,7 +180,7 @@ let Mesh = cc.Class({
* 设置顶点数据
* @method setVertices
* @param {String} name - the attribute name, e.g. gfx.ATTR_POSITION
* @param {[Vec2|Vec3|Color|Number]} values - the vertex values
* @param {[Vec2] | [Vec3] | [Color] | [Number] | Uint8Array | Float32Array} values - the vertex values
* @param {Number} [index]
*/
setVertices (name, values, index) {
Expand Down Expand Up @@ -258,9 +258,9 @@ let Mesh = cc.Class({
* !#zh
* 设置子网格索引。
* @method setIndices
* @param {[Number]} indices - the sub mesh indices.
* @param {Number} index - sub mesh index.
* @param {Boolean} dynamic - whether or not to use dynamic buffer.
* @param {[Number]|Uint16Array} indices - the sub mesh indices.
* @param {Number} [index] - sub mesh index.
* @param {Boolean} [dynamic] - whether or not to use dynamic buffer.
*/
setIndices (indices, index, dynamic) {
index = index || 0;
Expand Down
1 change: 1 addition & 0 deletions cocos2d/core/mesh/CCMeshRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ let ShadowCastingMode = cc.Enum({
* !#zh
* 网格渲染组件
* @class MeshRenderer
* @extends RenderComponent
*/
let MeshRenderer = cc.Class({
name: 'cc.MeshRenderer',
Expand Down
44 changes: 26 additions & 18 deletions cocos2d/core/value-types/mat4.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,30 +369,38 @@ js.mixin(Mat4.prototype, {
}
});

/**
* @module cc
*/

/**
* !#en The convenience method to create a new {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}}.
* !#zh 通过该简便的函数进行创建 {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}} 对象。
* @method mat4
* @param {Number} m00 Component in column 0, row 0 position (index 0)
* @param {Number} m01 Component in column 0, row 1 position (index 1)
* @param {Number} m02 Component in column 0, row 2 position (index 2)
* @param {Number} m03 Component in column 0, row 3 position (index 3)
* @param {Number} m10 Component in column 1, row 0 position (index 4)
* @param {Number} m11 Component in column 1, row 1 position (index 5)
* @param {Number} m12 Component in column 1, row 2 position (index 6)
* @param {Number} m13 Component in column 1, row 3 position (index 7)
* @param {Number} m20 Component in column 2, row 0 position (index 8)
* @param {Number} m21 Component in column 2, row 1 position (index 9)
* @param {Number} m22 Component in column 2, row 2 position (index 10)
* @param {Number} m23 Component in column 2, row 3 position (index 11)
* @param {Number} m30 Component in column 3, row 0 position (index 12)
* @param {Number} m31 Component in column 3, row 1 position (index 13)
* @param {Number} m32 Component in column 3, row 2 position (index 14)
* @param {Number} m33 Component in column 3, row 3 position (index 15)
* @param {Number} [m00] Component in column 0, row 0 position (index 0)
* @param {Number} [m01] Component in column 0, row 1 position (index 1)
* @param {Number} [m02] Component in column 0, row 2 position (index 2)
* @param {Number} [m03] Component in column 0, row 3 position (index 3)
* @param {Number} [m10] Component in column 1, row 0 position (index 4)
* @param {Number} [m11] Component in column 1, row 1 position (index 5)
* @param {Number} [m12] Component in column 1, row 2 position (index 6)
* @param {Number} [m13] Component in column 1, row 3 position (index 7)
* @param {Number} [m20] Component in column 2, row 0 position (index 8)
* @param {Number} [m21] Component in column 2, row 1 position (index 9)
* @param {Number} [m22] Component in column 2, row 2 position (index 10)
* @param {Number} [m23] Component in column 2, row 3 position (index 11)
* @param {Number} [m30] Component in column 3, row 0 position (index 12)
* @param {Number} [m31] Component in column 3, row 1 position (index 13)
* @param {Number} [m32] Component in column 3, row 2 position (index 14)
* @param {Number} [m33] Component in column 3, row 3 position (index 15)
* @return {Mat4}
*/
cc.mat4 = function mat4 (m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
return new Mat4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33);
cc.mat4 = function (m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
let mat = new Mat4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33);
if (m00 === undefined) {
mat4.identity(mat);
}
return mat;
};

module.exports = cc.Mat4 = Mat4;
4 changes: 4 additions & 0 deletions cocos2d/core/value-types/quat.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ proto.mul = function (other, out) {
return out;
};

/**
* @module cc
*/

/**
* !#en The convenience method to create a new {{#crossLink "Quat"}}cc.Quat{{/crossLink}}.
* !#zh 通过该简便的函数进行创建 {{#crossLink "Quat"}}cc.Quat{{/crossLink}} 对象。
Expand Down
4 changes: 4 additions & 0 deletions cocos2d/core/value-types/vec3.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,10 @@ js.get(Vec3, 'FRONT', function () {
return new Vec3(0.0, 0.0, 1.0);
});

/**
* @module cc
*/

/**
* !#en The convenience method to create a new {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}}.
* !#zh 通过该简便的函数进行创建 {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}} 对象。
Expand Down
4 changes: 4 additions & 0 deletions cocos2d/core/value-types/vec4.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ class Vec4 extends ValueType {

CCClass.fastDefine('cc.Vec4', Vec4, { x: 0, y: 0, z: 0, w: 0 });

/**
* @module cc
*/

/**
* !#en The convenience method to create a new {{#crossLink "Vec4"}}cc.Vec4{{/crossLink}}.
* !#zh 通过该简便的函数进行创建 {{#crossLink "Vec4"}}cc.Vec4{{/crossLink}} 对象。
Expand Down
2 changes: 2 additions & 0 deletions docs/apisrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"./cocos2d/core/assets/**/*",
"./cocos2d/core/3d/**/*",

"./cocos2d/core/mesh/**/*",

"./cocos2d/core/camera/CCCamera.js",

"./cocos2d/core/collider/**/*",
Expand Down

0 comments on commit f293022

Please sign in to comment.