API Documentation
1 /* 2 GLGE WebGL Graphics Engine 3 Copyright (c) 2010, Paul Brunt 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 * Redistributions of source code must retain the above copyright 9 notice, this list of conditions and the following disclaimer. 10 * Redistributions in binary form must reproduce the above copyright 11 notice, this list of conditions and the following disclaimer in the 12 documentation and/or other materials provided with the distribution. 13 * Neither the name of GLGE nor the 14 names of its contributors may be used to endorse or promote products 15 derived from this software without specific prior written permission. 16 17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 DISCLAIMED. IN NO EVENT SHALL PAUL BRUNT BE LIABLE FOR ANY 21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /** 30 * @fileOverview 31 * @name glge_animationvector.js 32 * @author me@paulbrunt.co.uk 33 */ 34 35 36 (function(GLGE){ 37 38 39 40 /** 41 * @class The AnimationVectors class allows you to specify the 2D Animation curves that define specific channels of animation within the engine. 42 * @augments GLGE.QuickNotation 43 * @augments GLGE.JSONLoader 44 */ 45 GLGE.AnimationVector=function(uid){ 46 this.curves={}; 47 GLGE.Assets.registerAsset(this,uid); 48 } 49 GLGE.augment(GLGE.QuickNotation,GLGE.AnimationVector); 50 GLGE.augment(GLGE.JSONLoader,GLGE.AnimationVector); 51 GLGE.AnimationVector.prototype.curves={}; 52 GLGE.AnimationVector.prototype.frames=250; 53 GLGE.AnimationVector.prototype.startFrame=0; 54 55 /** 56 * Adds an Animation Curve to a channel 57 * @param {String} channel The name of the curve to be added 58 * @param {GLGE.AnimationCurve} curve The animation curve to add 59 */ 60 GLGE.AnimationVector.prototype.addAnimationCurve=function(curve){ 61 this.curves[curve.channel]=curve; 62 return this; 63 } 64 /** 65 * Removes an Animation Curve form a channel 66 * @param {String} channel The name of the curve to be removed 67 */ 68 GLGE.AnimationVector.prototype.removeAnimationCurve=function(name){ 69 delete(this.curves[name]); 70 } 71 /** 72 * Sets the number of frames in the animation 73 * @param {number} value The number of frames in the animation 74 */ 75 GLGE.AnimationVector.prototype.setFrames=function(value){ 76 this.frames=value; 77 return this; 78 } 79 /** 80 * Sets the number of frames in the animation 81 * @returns {number} The number of frames in the animation 82 */ 83 GLGE.AnimationVector.prototype.getFrames=function(){ 84 return this.frames; 85 } 86 87 /** 88 * Sets the start frame 89 * @param {number} value The starting frame for the animation 90 */ 91 GLGE.AnimationVector.prototype.setStartFrame=function(value){ 92 this.startFrame=value; 93 return this; 94 } 95 /** 96 * Gets the start fames 97 * @returns {number} The starting frame for the animation 98 */ 99 GLGE.AnimationVector.prototype.getStartFrame=function(){ 100 return this.startFrame; 101 } 102 103 })(GLGE); 104