浏览代码

Adding More Docs

sebastien 7 年之前
父节点
当前提交
8ccef7db21
共有 3 个文件被更改,包括 81 次插入9 次删除
  1. 20 1
      src/Animations/babylon.animationGroup.ts
  2. 27 1
      src/Cameras/babylon.followCamera.ts
  3. 34 7
      src/Math/babylon.math.ts

+ 20 - 1
src/Animations/babylon.animationGroup.ts

@@ -20,6 +20,9 @@ module BABYLON {
         private _isStarted: boolean;
         private _speedRatio = 1;
 
+        /**
+         * This observable will notify when one animation have ended.
+         */
         public onAnimationEndObservable = new Observable<TargetedAnimation>();
 
         /**
@@ -90,7 +93,17 @@ module BABYLON {
             return this._animatables;
         }
 
-        public constructor(public name: string, scene: Nullable<Scene> = null) {
+        /**
+         * Instantiates a new Animation Group.
+         * This helps managing several animations at once. 
+         * @see http://doc.babylonjs.com/how_to/group
+         * @param name Defines the name of the group
+         * @param scene Defines the scene the group belongs to
+         */
+        public constructor(
+            /** The name of the animation group */
+            public name: string, 
+            scene: Nullable<Scene> = null) {
             this._scene = scene || Engine.LastCreatedScene!;
 
             this._scene.animationGroups.push(this);
@@ -127,6 +140,7 @@ module BABYLON {
          * It can add constant keys at begin or end
          * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)
          * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)
+         * @returns the animation group
          */
         public normalize(beginFrame: Nullable<number> = null, endFrame: Nullable<number> = null): AnimationGroup {
             if (beginFrame == null) beginFrame = this._from;
@@ -198,6 +212,7 @@ module BABYLON {
 
         /**
          * Pause all animations
+         * @returns the animation group
          */
         public pause(): AnimationGroup {
             if (!this._isStarted) {
@@ -218,6 +233,7 @@ module BABYLON {
          * Play all animations to initial state
          * This function will start() the animations if they were not started or will restart() them if they were paused
          * @param loop defines if animations must loop
+         * @returns the animation group
          */
         public play(loop?: boolean): AnimationGroup {
             // only if all animatables are ready and exist
@@ -239,6 +255,7 @@ module BABYLON {
 
         /**
          * Reset all animations to initial state
+         * @returns the animation group
          */
         public reset(): AnimationGroup {
             if (!this._isStarted) {
@@ -255,6 +272,7 @@ module BABYLON {
 
         /**
          * Restart animations from key 0
+         * @returns the animation group
          */
         public restart(): AnimationGroup {
             if (!this._isStarted) {
@@ -271,6 +289,7 @@ module BABYLON {
 
         /**
          * Stop all animations
+         * @returns the animation group
          */
         public stop(): AnimationGroup {
             if (!this._isStarted) {

+ 27 - 1
src/Cameras/babylon.followCamera.ts

@@ -89,11 +89,33 @@
         }
     }
 
+    /**
+     * Arc Rotate version of the follow camera.
+     * It still follows a defined mesh but in an Arc Rotate Camera fashion.
+     */
     export class ArcFollowCamera extends TargetCamera {
 
         private _cartesianCoordinates: Vector3 = Vector3.Zero();
 
-        constructor(name: string, public alpha: number, public beta: number, public radius: number, public target: Nullable<AbstractMesh>, scene: Scene) {
+        /**
+         * Instantiates a new ArcFollowCamera
+         * @param name Defines the name of the camera
+         * @param alpha Defines the rotation angle of the camera around the logitudinal axis
+         * @param beta Defines the rotation angle of the camera around the elevation axis
+         * @param radius Defines the radius of the camera from its target point
+         * @param target Defines the target of the camera
+         * @param scene Defines the scene the camera belongs to
+         */
+        constructor(name: string, 
+            /** The longitudinal angle of the camera */
+            public alpha: number, 
+            /** The latitudinal angle of the camera */
+            public beta: number, 
+            /** The radius of the camera from its target */
+            public radius: number, 
+            /** Defines the camera target (the messh it should follow) */
+            public target: Nullable<AbstractMesh>, 
+            scene: Scene) {
             super(name, Vector3.Zero(), scene);
             this.follow();
         }
@@ -117,6 +139,10 @@
             this.follow();
         }
 
+        /**
+         * Returns the class name of the object.
+         * It is mostly used internally for serialization purposes.
+         */
         public getClassName(): string {
             return "ArcFollowCamera";
         }

+ 34 - 7
src/Math/babylon.math.ts

@@ -6196,17 +6196,44 @@
         }
     }
 
+    /**
+     * This represents an arc in a 2d space.
+     */
     export class Arc2 {
-        centerPoint: Vector2;
-        radius: number;
-        angle: Angle;
-        startAngle: Angle;
-        orientation: Orientation;
+        /**
+         * Defines the center point of the arc.
+         */
+        public centerPoint: Vector2;
+        /**
+         * Defines the radius of the arc.
+         */
+        public radius: number;
+        /**
+         * Defines the angle of the arc (from mid point to end point).
+         */
+        public angle: Angle;
+        /**
+         * Defines the start angle of the arc (from start point to middle point).
+         */
+        public startAngle: Angle;
+        /**
+         * Defines the orientation of the arc (clock wise/counter clock wise).
+         */
+        public orientation: Orientation;
 
         /**
-         * Creates an Arc object from the three given points : start, middle and end.  
+         * Creates an Arc object from the three given points : start, middle and end.
+         * @param startPoint Defines the start point of the arc
+         * @param midPoint Defines the midlle point of the arc
+         * @param endPoint Defines the end point of the arc
          */
-        constructor(public startPoint: Vector2, public midPoint: Vector2, public endPoint: Vector2) {
+        constructor(
+            /** Defines the start point of the arc */
+            public startPoint: Vector2, 
+            /** Defines the mid point of the arc */
+            public midPoint: Vector2, 
+            /** Defines the end point of the arc */
+            public endPoint: Vector2) {
 
             var temp = Math.pow(midPoint.x, 2) + Math.pow(midPoint.y, 2);
             var startToMid = (Math.pow(startPoint.x, 2) + Math.pow(startPoint.y, 2) - temp) / 2.;