Переглянути джерело

📝 Add documentation to several Padonra files (30/30)

- Add documentation to Color, Ellipse, Rect, Signal and Vector2 Components,
- Add documentation to AudioRes, FontRes, TextureRes and SpriteFrames Resrouces,
- Add documentation to Easings and Enums singletons.
Pedro Schneider 3 роки тому
батько
коміт
a00356fe1a

+ 23 - 0
pandora/components/Color.js

@@ -19,8 +19,26 @@
  * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
  *************************************************************************/
 
+/**
+ * This {@code Color} class provides an interface to store a color as a component to
+ * any GameObject.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @class
+ */
 class Color
 {
+    /**
+     * Initializes a Color with the given parameters.
+     * 
+     * @param {number(0, 255)} r 
+     * @param {number(0, 255)} g 
+     * @param {number(0, 255)} b 
+     * @param {number(0, 255)} a 
+     * 
+     * @constructor
+     */
     constructor(r, g, b, a = 255)
     {
         this.r = r;
@@ -31,6 +49,11 @@ class Color
         this.p5Color = color(this.r, this.g, this.b, this.a);
     }
 
+    /**
+     * Converts the color data in this Color component to a p5.Color.
+     * 
+     * @returns {p5.Color}  p5.Color representing this Color component.
+     */
     getP5Color()
     {
         this.p5Color.setRed(this.r);

+ 16 - 0
pandora/components/Ellipse.js

@@ -19,8 +19,24 @@
  * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
  *************************************************************************/
 
+/**
+ * This {@code Ellipse} class provides an interface to store an ellipse as a component to
+ * any GameObject.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @class
+ */
 class Ellipse
 {
+    /**
+     * Initializes an Ellipse with the given parameters.
+     * 
+     * @param {number} rx   radius on the X axis. 
+     * @param {number} ry   radius on the Y axis. Default is the same as the X axis.
+     * 
+     * @constructor
+     */
     constructor(rx, ry = rx)
     {
         this.rx = rx;

+ 16 - 0
pandora/components/Rect.js

@@ -19,8 +19,24 @@
  * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
  *************************************************************************/
 
+/**
+ * This {@code Rect} class provides an interface to store a rectangle as a component to
+ * any GameObject.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @class
+ */
 class Rect
 {
+    /**
+     * Initializes a Rect with the given parameters.
+     * 
+     * @param {number} w    width of the Rect.
+     * @param {number} h    height of the Rect.
+     * 
+     * @constructor
+     */
     constructor(w, h = w)
     {
         this.w = w;

+ 31 - 0
pandora/components/Signal.js

@@ -1,3 +1,34 @@
+/************************************************************************
+ * Signal.js
+ ************************************************************************
+ * Copyright (c) 2021 Pedro Tonini Rosenberg Schneider.
+ *
+ * This file is part of Pandora.
+ *
+ * Pandora is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Pandora is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *     
+ * You should have received a copy of the GNU General Public License     
+ * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
+ *************************************************************************/
+
+/**
+ * This {@code Signal} class provides an object to store data about a signal.
+ * 
+ * ! This class should not be used directly by the user. To add signals to GameObjects
+ * ! use the addSignal() method from the object inside the _initSignals() callback.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @class
+ */
 class Signal
 {
     constructor(name)

+ 98 - 1
pandora/components/Vector2.js

@@ -19,68 +19,165 @@
  * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
  *************************************************************************/
 
+/**
+ * This {@code Vector2} class provides an interface to store a 2D vector as a component to
+ * any GameObject.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @class
+ */
 class Vector2
 {
+    /**
+     * Creates a Vector2 with length 0.
+     * 
+     * @returns {Vector2}   length 0 Vector2.
+     */
     static ZERO()
     {
         return new Vector2(0, 0);
     }
+
+    /**
+     * Creates a Vector2 with both dimetions equal to 1.
+     * 
+     * @returns {Vector2}   Vector2 with both dimentions equal to 1.
+     */
     static ONE()
     {
         return new Vector2(1, 1);
     }
+
+    /**
+     * Creates a Vector2 pointing right.
+     * 
+     * @returns {Vector2}   Vector2 pointing right.
+     */
     static RIGHT()
     {
         return new Vector2(1, 0);
     }
+
+    /**
+     * Creates a Vector2 pointing left.
+     * 
+     * @returns {Vector2}   Vector2 pointing left.
+     */
     static LEFT()
     {
         return new Vector2(-1, 0);
     }
+
+    /**
+     * Creates a Vector2 pointing up.
+     * 
+     * @returns {Vector2}   Vector2 pointing up.
+     */
     static UP()
     {
         return new Vector2(0, -1);
     }
+
+    /**
+     * Creates a Vector2 pointing down.
+     * 
+     * @returns {Vector2}   Vector2 pointing down.
+     */
     static DOWN()
     {
         return new Vector2(0, 1);
     }
 
+    /**
+     * Initializes a Vector2 with the given dimentions.
+     * @param {number} x 
+     * @param {number} y 
+     * 
+     * @constructor
+     */
     constructor(x, y)
     {
         this.x = x;
         this.y = y;
     }
 
-    // Methods
+    /**
+     * Creates a Vector2 with de dimentions equal to the absolute value of
+     * this Vector2's dimentions.
+     * 
+     * @returns {Vector2}   created Vector2.
+     */
     abs()
     {
         return new Vector2(abs(this.x), abs(this.y));
     }
 
+    /**
+     * Returns this Vector2's angle in radians with respect to the positive X axis,
+     * or the (1, 0) vector.
+     *  
+     * @returns {number}    angle in radian between this Vector2 and the positive X axis.
+     */
     angle()
     {
         return atan2(this.y, this.x);
     }
 
+    /**
+     * Returns this Vector2's length squared.
+     * 
+     * @returns {number}    this Vector2's length squared.
+     */
     lengthSquared()
     {
         return this.x * this.x + this.y * this.y;
     }
 
+    /**
+     * Returns this Vector2's length.
+     * 
+     * @returns {number}    this Vector2's length. 
+     */
     length()
     {
         return sqrt(this.lengthSquared());
     }
 
+    /**
+     * Creates a Vector2 with length 1 pointing in the same direction of this Vector2.
+     * 
+     * @returns {Vector2}   normalized vector.
+     */
     normalized()
     {
         let len = this.length();
         return new Vector2(this.x / len, this.y / len);
     }
 
+    /**
+     * Returns this Vector2's distance squared to another Vector2.
+     * 
+     * @param {Vector2} v   Vector2 to calculate the distance to.
+     * 
+     * @returns {number}    distance squared between this Vector2 and the provided
+     *                      Vector2. 
+     */
     distanceSquaredTo(v)
     {
         return new Vector2(v.x - this.x, v.y - this.y).length();
     }
+
+    /**
+     * Returns this Vector2's distance to another Vector2.
+     * 
+     * @param {Vector2} v   Vector2 to calculate the distance to.
+     * 
+     * @returns {number}    distance between this Vector2 and the provided
+     *                      Vector2. 
+     */
+    distance(v)
+    {
+        return sqrt(this.distanceSquaredTo(v));
+    }
 }

+ 16 - 0
pandora/resources/AudioRes.js

@@ -19,8 +19,24 @@
  * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
  *************************************************************************/
 
+/**
+ * This {@code AudioRes} class provides an interface to store an audio resource into
+ * memory to be accessed later.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @class
+ */
 class AudioRes
 {
+    /**
+     * Initializes an audio resource with the given parameters.
+     * 
+     * @param {String} name         name of the audio resource.
+     * @param {p5.Audio} p5Audio    audio data for the audio resource.
+     * 
+     * @constructor
+     */
     constructor(name = "", p5Audio = null)
     {
         this.name = name;

+ 16 - 0
pandora/resources/FontRes.js

@@ -19,8 +19,24 @@
  * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
  *************************************************************************/
 
+/**
+ * This {@code FontRes} class provides an interface to store a font resource into
+ * memory to be accessed later.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @class
+ */
 class FontRes
 {
+    /**
+     * Initializes a font resource with the given parameters.
+     * 
+     * @param {String} name         name of the font resource.
+     * @param {p5.Audio} p5font     audio data for the font resource.
+     * 
+     * @constructor
+     */
     constructor(name = "", p5Font = null)
     {
         this.name = name;

+ 122 - 15
pandora/resources/SpriteFrames.js

@@ -19,8 +19,32 @@
  * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
  *************************************************************************/
 
+/**
+ * This {@code SpriteAnimation} class provides an interface to store an animation in the form
+ * of a series of images.
+ * 
+ * ! This class has no use in the engine aside from holding the data for an animation inside a
+ * ! SpriteFrames object. Its use is not recomended anywhere else.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @class
+ */
 class SpriteAnimation
 {
+    /**
+     * Initialize a SpriteAnimation with the given parameters.
+     * 
+     * @param {String} name         name for the SpriteAnimation.
+     * @param {p5.Image} p5Image    p5.Image holding all the frames for the aniamtion.
+     * @param {number} rows         number of rows of frames the image has.
+     * @param {number} cols         number of columns of frames the image has.
+     * @param {Array} indices       indices of the frames from left-to-right and top-to-bottom
+     *                              that should be included in the animation.
+     * @param {number} fps          frames per second the animation should be played at.
+     * 
+     * @constructor 
+     */
     constructor(name = "default", p5Image, rows, cols, indices, fps)
     {
         this.name = name;
@@ -31,6 +55,7 @@ class SpriteAnimation
         this.numFrames = this.indices.length;
         this.frameTime = 1 / fps;
 
+        // Extract all the requested frames from the image as individual p5.Images.
         this.frames = [];
         for (let i = 0; i < this.numFrames; i++)
         {
@@ -38,59 +63,124 @@ class SpriteAnimation
         }
     }
 
+    /**
+     * Extracts a frame from the full image based on its index on the image, from left-to-right and
+     * top-to-bottom.
+     * 
+     * @param {number} idx  index of the desired frame on the full image.
+     * 
+     * @returns {p5.Image}  frame with the requested index on the full image.
+     */
+    makeFrame(idx)
+    {
+        let r = int(this.indices[idx] / this.columns);
+        let c = this.indices[idx] % this.columns;
+        let w = this.fullP5Image.width / this.columns;
+        let h = this.fullP5Image.height / this.rows;
+        let x = c * w;
+        let y = r * h;
+        return this.fullP5Image.get(x, y, w, h);
+    }
+
+    /**
+     * Sets the time between frames for the animation.
+     * 
+     * @param {number} time new time between frames for the animation.
+     */
     setFrameTime(time)
     {
         this.frameTime = time;
     }
 
+    /**
+     * Sets the frames per second for the animation.
+     * 
+     * @param {number} fps  new frames per second value for the animation.
+     */
     setFPS(fps)
     {
         this.frameTime = 1 / fps;
     }
 
+    /**
+     * Returns a frame of the animation based on its index.
+     * 
+     * @param {number} idx  index of the desired frame on the animation.
+     * 
+     * @returns {p5.Image}  frame with the requested index on the animation, or null if
+     *                      the requested index is invalid.
+     */
     getFrame(idx)
     {
-        if (idx < this.numFrames)
+        if (idx >= 0 && idx < this.numFrames)
             return this.frames[idx];
         return null;
     }
 
+    /**
+     * Returns the time between frames for the animation.
+     * 
+     * @returns {number}    time between frames for the aniamtion.
+     */
     getFrameTime()
     {
         return this.frameTime;
     }
 
+    /**
+     * Returns the number of frames the animation has.
+     * 
+     * @returns {number}    number of frames the animation has.
+     */
     getNumFrames()
     {
         return this.numFrames;
     }
-
-    makeFrame(idx)
-    {
-        let r = int(this.indices[idx] / this.columns);
-        let c = this.indices[idx] % this.columns;
-        let w = this.fullP5Image.width / this.columns;
-        let h = this.fullP5Image.height / this.rows;
-        let x = c * w;
-        let y = r * h;
-        return this.fullP5Image.get(x, y, w, h);
-    }
 }
 
+/**
+ * This {@code SpriteFrames} class provides an interface to store multiple related SpriteAnimations
+ * inside a sigle object for use with the AnimatedSprite2D GameObject.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @class
+ */
 class SpriteFrames
 {
+    /**
+     * Initializes an empty SpriteFrames.
+     * 
+     * @constructor
+     */
     constructor()
     {
         this.animations = [];
         this.numAnimations = 0;
     }
 
+    /**
+     * Returns an animation based on its index on the list of aniamtions.
+     * 
+     * @param {number} idx          index of the desired animation.
+     * 
+     * @returns {SpriteAnimation}   animation with the requested index, or null if the
+     *                              index is invalid.
+     */
     getAnimationByIndex(idx)
     {
-        if (idx < this.numAnimations) return this.animations[idx];
+        if (idx >= 0 && idx < this.numAnimations) return this.animations[idx];
         return null;
     }
 
+    /**
+     * Returns an animation baes on its name.
+     * 
+     * @param {String} name         name of the desired animation.
+     * 
+     * @returns {SpriteAnimation}   animation with the requested name, or
+     *                              null if no animation has that name. 
+     */
     getAnimationByName(name)
     {
         for (let i = 0; this.numAnimations; i++)
@@ -103,18 +193,35 @@ class SpriteFrames
         return null;
     }
 
+    /**
+     * Returns the index of an animation on the list of animations based on its name.
+     * 
+     * @param {number} name name of the desired animation.
+     * @returns {number}    index on the list of animations of the animation with the requested
+     *                      name, or null if no animation has that name
+     */
     getAnimationIndexByName(name)
     {
         for (let i = 0; this.numAnimations; i++)
         {
             if (this.animations[i].name == name)
-            {
                 return i;
-            }
         }
         return null;
     }
 
+    /**
+     * Adds a new SprteAniamtion to the list of aniamtions with the given data.
+     * 
+     * @param {String} name         name for the SpriteAnimation.
+     * @param {p5.Image} p5Image    p5.Image holding all the frames for the aniamtion.
+     * @param {number} rows         number of rows of frames the image has.
+     * @param {number} cols         number of columns of frames the image has.
+     * @param {Array} indices       indices of the frames from left-to-right and top-to-bottom
+     *                              that should be included in the animation.
+     * @param {number} fps          frames per second the animation should be played at.
+     *                              Default is 24.
+     */
     addAnimation(name, p5Image, rows, cols, indices, fps = 24)
     {
         this.animations.push(new SpriteAnimation(name, p5Image, rows, cols, indices, fps));

+ 16 - 0
pandora/resources/TextureRes.js

@@ -19,8 +19,24 @@
  * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
  *************************************************************************/
 
+/**
+ * This {@code Textureres} class provides an interface to store a texture resource into
+ * memory to be accessed later.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @class
+ */
 class TextureRes
 {
+    /**
+     * Initializes a texture resource with the given parameters.
+     * 
+     * @param {String} name         name of the texture resource.
+     * @param {p5.Audio} p5Image     audio data for the texture resource.
+     * 
+     * @constructor
+     */
     constructor(name = "", p5Image = null)
     {
         this.name = name;

+ 373 - 11
pandora/singletons/Easings.js

@@ -19,7 +19,7 @@
  * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
  *************************************************************************/
 
-/*
+/**
  *
  * Derived from Robert Penner's easing equations: http://robertpenner.com/easing/
  * The original copyright notice is as follows:
@@ -55,30 +55,86 @@
  *
  */
 
+/**
+ * This {@code Easings} singleton provides an interface for the engine to utilize
+ * various easing equations. Used mostly on the Tween GameObject. User can access this
+ * API, but it is not recomended; try using tweens instead.
+ * 
+ * @author Pedro Schneider
+ * 
+ * @namespace
+ */
 const Easings = {
-    // See https://easings.net/ for more details on each type of easing.
-    // t: current time, b: begInnIng value, c: change In value, d: duration.
+    // * See https://easings.net/ for more details on each type of easing.
 
+    /**
+     * Namespace to separate linear easing equations.
+     * @namespace
+     */
     Linear:
     {
+        /**
+         * Calculates a linear easing.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         ease: function(t, b, c, d)
         {
             return b + (c * t / d);
         }
     },
 
+    /**
+     * Namespace to separate quadratic easing equations.
+     * @namespace
+     */
     Quad:
     {
+        /**
+         * Calculates a quadratic ease-in.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeIn: function(t, b, c, d)
         {
             return c * (t /= d) * t + b;
         },
 
+        /**
+         * Calculates a quadratic ease-out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeOut: function(t, b, c, d)
         {
             return -c * (t /= d) * (t - 2) + b;
         },
 
+        /**
+         * Calculates a quadratic ease-in and out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeInOut: function(t, b, c, d)
         {
             if ((t /= d / 2) < 1) return c / 2 * t * t + b;
@@ -86,18 +142,52 @@ const Easings = {
         }
     },
 
+    /**
+     * Namespace to separate cubic easing equations.
+     * @namespace
+     */
     Cubic:
     {
+        /**
+         * Calculates a cubic ease-in.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeIn: function(t, b, c, d)
         {
             return c * (t /= d) * t * t + b;
         },
 
+        /**
+         * Calculates a cubic ease-out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeOut: function(t, b, c, d)
         {
             return c * ((t = t / d - 1) * t * t + 1) + b;
         },
 
+        /**
+         * Calculates a cubic ease-in and out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeInOut: function(t, b, c, d)
         {
             if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
@@ -105,18 +195,52 @@ const Easings = {
         }
     },
 
+    /**
+     * Namespace to separate quartic easing equations.
+     * @namespace
+     */
     Quart:
     {
+        /**
+         * Calculates a quartic ease-in.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeIn: function(t, b, c, d)
         {
             return c * (t /= d) * t * t * t + b;
         },
 
+        /**
+         * Calculates a quartic ease-out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeOut: function(t, b, c, d)
         {
             return -c * ((t = t / d - 1) * t * t * t - 1) + b;
         },
 
+        /**
+         * Calculates a quartic ease-in and out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeInOut: function(t, b, c, d)
         {
             if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
@@ -124,18 +248,52 @@ const Easings = {
         }
     },
 
+    /**
+     * Namespace to separate quintic easing equations.
+     * @namespace
+     */
     Quint:
     {
+        /**
+         * Calculates a quintic ease-in.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeIn: function(t, b, c, d)
         {
             return c * (t /= d) * t * t * t * t + b;
         },
 
+        /**
+         * Calculates a quintic ease-out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeOut: function(t, b, c, d)
         {
             return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
         },
 
+        /**
+         * Calculates a quintic ease-in and out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeInOut: function(t, b, c, d)
         {
             if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
@@ -143,36 +301,104 @@ const Easings = {
         }
     },
 
+    /**
+     * Namespace to separate senoidal easing equations.
+     * @namespace
+     */
     Sine:
     {
+        /**
+         * Calculates a senoidal ease-in;
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeIn: function(t, b, c, d)
         {
             return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
         },
 
+        /**
+         * Calculates a senoidal ease-out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeOut: function(t, b, c, d)
         {
             return c * Math.sin(t / d * (Math.PI / 2)) + b;
         },
 
+        /**
+         * Calculates a senoidal ease-in and out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeInOut: function(t, b, c, d)
         {
             return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
         }
     },
 
+    /**
+     * Namespace to separate exponential easing equations.
+     * @namespace
+     */
     Expo:
     {
+        /**
+         * Calculates an exponential ease-in.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeIn: function(t, b, c, d)
         {
             return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
         },
 
+        /**
+         * Calculates an exponential ease-out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeOut: function(t, b, c, d)
         {
             return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
         },
 
+        /**
+         * Calculates an exponential ease-in and out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeInOut: function(t, b, c, d)
         {
             if (t == 0) return b;
@@ -182,18 +408,52 @@ const Easings = {
         }
     },
 
+    /**
+     * Namespace to separate circular easing equations.
+     * @namespace
+     */
     Circ:
     {
+        /**
+         * Calculates a circular ease-in.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeIn: function(t, b, c, d)
         {
             return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
         },
 
+        /**
+         * Calculates a circular ease-out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeOut: function(t, b, c, d)
         {
             return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
         },
-        
+
+        /**
+         * Calculates a circular ease-in and out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeInOut: function(t, b, c, d)
         {
             if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
@@ -201,8 +461,22 @@ const Easings = {
         }
     },
 
+    /**
+     * Namespace to separate elastic easing equations.
+     * @namespace
+     */
     Elastic:
     {
+        /**
+         * Calculates an elastic ease-in.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeIn: function(t, b, c, d)
         {
             var s = 1.70158;
@@ -220,6 +494,16 @@ const Easings = {
             return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
         },
 
+        /**
+         * Calculates an elastic ease-out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeOut: function(t, b, c, d)
         {
             var s = 1.70158;
@@ -237,6 +521,16 @@ const Easings = {
             return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
         },
 
+        /**
+         * Calculates an elastic ease-in and out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeInOut: function(t, b, c, d)
         {
             var s = 1.70158;
@@ -256,35 +550,93 @@ const Easings = {
         },
     },
 
+    /**
+     * Namespace to separate back easing equations.
+     * @namespace
+     */
     Back:
     {
-        easeIn: function(t, b, c, d, s)
+        /**
+         * Calculates a back ease-in.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
+        easeIn: function(t, b, c, d)
         {
-            if (s == undefined) s = 1.70158;
+            var s = 1.70158;
             return c * (t /= d) * t * ((s + 1) * t - s) + b;
         },
 
-        easeOut: function(t, b, c, d, s)
+        /**
+         * Calculates a back ease-out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
+        easeOut: function(t, b, c, d)
         {
-            if (s == undefined) s = 1.70158;
+            var s = 1.70158;
             return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
         },
 
-        easeInOut: function(t, b, c, d, s)
+        /**
+         * Calculates a back ease-in and out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
+        easeInOut: function(t, b, c, d)
         {
-            if (s == undefined) s = 1.70158;
+            var s = 1.70158;
             if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
             return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
         }
     },
 
+    /**
+     * Namespace to separate bounce easing equations.
+     * @namespace
+     */
     Bounce:
     {
+        /**
+         * Calculates a bounce ease-in.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeIn: function(t, b, c, d)
         {
             return c - Easings.Bounce.easeOut(d - t, 0, c, d) + b;
         },
 
+        /**
+         * Calculates a bounce ease-out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeOut: function(t, b, c, d)
         {
             if ((t /= d) < (1 / 2.75))
@@ -296,7 +648,17 @@ const Easings = {
             else
                 return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
         },
-        
+
+        /**
+         * Calculates a bounce ease-in and out.
+         * 
+         * @param {number} t    current time of the easing process.
+         * @param {number} b    beginning value of the esasing process.
+         * @param {number} c    change in vlaue during the easing process.
+         * @param {number} d    total duration of the easing process.
+         *  
+         * @returns {number}    current value in the easing process.
+         */
         easeInOut: function(t, b, c, d)
         {
             if (t < d / 2) return Easings.Bounce.easeIn(t * 2, 0, c, d) * .5 + b;

+ 31 - 4
pandora/singletons/Enums.js

@@ -19,12 +19,34 @@
  * along with Pandora.  If not, see <https://www.gnu.org/licenses/>.
  *************************************************************************/
 
+/**
+ * This {@code Enums} file provides several useful constant enumerators the engine
+ * uses internaly. Users may find these useful for calling certain functions.
+ * 
+ * @author Pedro Schneider
+ */
+
+
+/**
+ * Enumerates property types.
+ */
 const PROPERTY_TYPE = {
     NUMBER: 1,
     VECTOR2: 2,
     COLOR: 3,
 };
 
+/**
+ * Enumerates shape types.
+ */
+const SHAPES = {
+    RECT: 1,
+    ELLIPSE: 2,
+};
+
+/**
+ * Enumerates transition types.
+ */
 const TRANS_TYPE = {
     LINEAR: 1,
     QUAD: 2,
@@ -39,22 +61,27 @@ const TRANS_TYPE = {
     BOUNCE: 11,
 };
 
+/**
+ * Enumerates easing types.
+ */
 const EASE_TYPE = {
     IN: 1,
     OUT: 2,
     IN_OUT: 3,
 };
 
-const SHAPES = {
-    RECT: 1,
-    ELLIPSE: 2,
-};
 
+/**
+ * Enumerates render modes.
+ */
 const RENDER_MODES = {
     P2D: 1,
     WEBGL: 2,
 };
 
+/**
+ * Object to hold information about the default styling of UIOBjects.
+ */
 const STYLE = {
     DEFAULT_FONT_SIZE: 20,