1 /** 2 * Copyright (C) 2009-2012 Klaus Reimer <k@ailis.de> 3 * See LICENSE.txt for licensing information 4 * 5 * @require threedee.js 6 * @require threedee/updater/NodeUpdater.js 7 */ 8 9 /** 10 * Constructs a new yaw updater. 11 * 12 * @param {number} angle 13 * The angle the node should be rotated around the Y axis per 14 * second. Measured in clock-wise RAD. 15 * @constructor 16 * @extends {threedee.NodeUpdater} 17 * @class 18 * The yaw updater rotates a node around the Y axis. 19 */ 20 threedee.YawUpdater = function(angle) 21 { 22 threedee.NodeUpdater.call(this); 23 this.angle = angle; 24 }; 25 threedee.inherit(threedee.YawUpdater, threedee.NodeUpdater); 26 27 /** 28 * The rotation angle in clock-wise RAD per second. 29 * @private 30 * @type {number} 31 */ 32 threedee.YawUpdater.prototype.angle; 33 34 /** 35 * Returns the current angle. 36 * 37 * @return {number} 38 * The angle the node is rotated around the X axis per second. 39 * Measured in clock-wise RAD. 40 */ 41 threedee.YawUpdater.prototype.getAngle = function() 42 { 43 return this.angle; 44 }; 45 46 /** 47 * Sets the angle. 48 * 49 * @param {number} angle 50 * The angle the node should be rotated around the X axis per 51 * second. Measured in clock-wise RAD. 52 */ 53 threedee.YawUpdater.prototype.setAngle = function(angle) 54 { 55 this.angle = angle; 56 }; 57 58 /** 59 * @inheritDoc 60 * 61 * @param {!threedee.SceneNode} node 62 * @param {number} delta 63 */ 64 threedee.YawUpdater.prototype.update = function(node, delta) 65 { 66 // Do nothing if angle is 0 67 if (this.angle == 0) return; 68 69 node.getTransform().rotateY(this.angle * delta / 1000); 70 }; 71