1 /**
  2  * @class mutator
  3  * @extends component
  4  * @description
  5  *  A piecewise function manager that changes inputs
  6  *  over time.
  7  *
  8  *  There are some instances where it is useful to model
  9  *  the transformation of a value in a complex manner. The mutator component
 10  *  provides functionality for simple and complex easing. You can string easing functions
 11  *  together to achieve more complex behavior in one instance of a Mutator through
 12  *  the mutation interface. For more simple easing, see {@link sandboxe.ease}.
 13  *  All times are delt with in seconds and
 14  *  the Mutator always begins at time 0.
 15  *
 16  * 
 17  */ 
 18 function mutator() {
 19 
 20     /**
 21      * Removes all mutations.
 22      * @param {Number} startValue The value to start the mutator at before mutations take place.
 23      */
 24     this.clear = function(startValue){};
 25 
 26     /**
 27      * Adds a new mutation.
 28      * @param {Number} when The time that the mutation will be over, in seconds.
 29      * @param {Number} value The value that should be reached when the mutation is over.
 30      * @param {Number} mutationType See {@link sandboxe.mutator.mutation}
 31      */
 32     this.add = function(){};
 33 
 34     /**
 35      * Starts the mutation lifetime. If it was already started, this function starts the 
 36      * mutation lifetime from the beginning.
 37      */
 38     this.start = function(){};
 39 
 40     /**
 41      * Stops the mutation lifetime. Once stopped, the mutation's value is set as if all mutations finished normally.
 42      */
 43     this.stop = function(){};
 44 
 45     /**
 46      * Returns the value of the mutator at the given time in seconds based on all added mutations.
 47      * @param {Number} time The time to request in seconds.
 48      * @returns {Number} The value at that time.
 49      */
 50     this.getAt = function(){};
 51 
 52     /**
 53      * Returns the current value of the mutation state. See {@link mutator.start}.
 54      */
 55     this.value = function(){};
 56 
 57 
 58 
 59 
 60     /**
 61      * Returns whether the mutator's life cycle has expired. Writing to this value has no effect.
 62      * @type {Number}
 63      */
 64     this.expired = 0.0;
 65 
 66     /**
 67      * Returns the current time elapsed since starting the mutation life cycle. Writing to this value has no effect
 68      * @type {Number}
 69      */
 70     this.currentTime = 0.0;
 71 
 72     /**
 73      * Returns the duration of the mutator based on current mutations. Writing to this value has no effect.
 74      * @type {Number}
 75      */
 76     this.duration = 0.0;
 77 
 78     /**
 79      * Whether the mutator should loop automatically once the lifetime has elapsed. The default is false.
 80      * @type {Number}
 81      */
 82     this.loop = 0.0;
 83 
 84 
 85 
 86 
 87 
 88 
 89     return this;
 90 }
 91