Modified: ode/trunk/axis2-war/src/main/webapp/js/yui/animation.js URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/main/webapp/js/yui/animation.js?rev=948937&r1=948936&r2=948937&view=diff ============================================================================== --- ode/trunk/axis2-war/src/main/webapp/js/yui/animation.js (original) +++ ode/trunk/axis2-war/src/main/webapp/js/yui/animation.js Thu May 27 18:09:53 2010 @@ -33,9 +33,9 @@ http://developer.yahoo.net/yui/license.t * @requires YAHOO.util.CustomEvent * @constructor * @param {String | HTMLElement} el Reference to the element that will be animated - * @param {Object} attributes The attribute(s) to be animated. - * Each attribute is an object with at minimum a "to" or "by" member defined. - * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). + * @param {Object} attributes The attribute(s) to be animated. + * Each attribute is an object with at minimum a "to" or "by" member defined. + * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). * All attribute names use camelCase. * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) @@ -44,7 +44,7 @@ http://developer.yahoo.net/yui/license.t var Anim = function(el, attributes, duration, method) { if (!el) { } - this.init(el, attributes, duration, method); + this.init(el, attributes, duration, method); }; Anim.NAME = 'Anim'; @@ -60,14 +60,14 @@ Anim.prototype = { var id = el.id || el.tagName; return (this.constructor.NAME + ': ' + id); }, - + patterns: { // cached for performance noNegatives: /width|height|opacity|padding/i, // keep at zero or above offsetAttribute: /^((width|height)|(top|left))$/, // use offsetValue as default defaultUnit: /width|height|top$|bottom$|left$|right$/i, // use 'px' by default offsetUnit: /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i // IE may return these, so convert these to offset }, - + /** * Returns the value computed by the animation's "method". * @method doMethod @@ -79,7 +79,7 @@ Anim.prototype = { doMethod: function(attr, start, end) { return this.method(this.currentFrame, start, end - start, this.totalFrames); }, - + /** * Applies a value to an attribute. * @method setAttribute @@ -93,8 +93,8 @@ Anim.prototype = { } Y.Dom.setStyle(this.getEl(), attr, val + unit); - }, - + }, + /** * Returns current value of the attribute. * @method getAttribute @@ -108,11 +108,11 @@ Anim.prototype = { if (val !== 'auto' && !this.patterns.offsetUnit.test(val)) { return parseFloat(val); } - + var a = this.patterns.offsetAttribute.exec(attr) || []; var pos = !!( a[3] ); // top or left var box = !!( a[2] ); // width or height - + // use offsets for width/height and abs pos top/left if ( box || (Y.Dom.getStyle(el, 'position') == 'absolute' && pos) ) { val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)]; @@ -122,7 +122,7 @@ Anim.prototype = { return val; }, - + /** * Returns the unit to use when none is supplied. * @method getDefaultUnit @@ -133,15 +133,15 @@ Anim.prototype = { if ( this.patterns.defaultUnit.test(attr) ) { return 'px'; } - + return ''; }, - + /** * Sets the actual values to be used during the animation. Should only be needed for subclass use. * @method setRuntimeAttribute * @param {Object} attr The attribute object - * @private + * @private */ setRuntimeAttribute: function(attr) { var start; @@ -149,15 +149,15 @@ Anim.prototype = { var attributes = this.attributes; this.runtimeAttributes[attr] = {}; - + var isset = function(prop) { return (typeof prop !== 'undefined'); }; - + if ( !isset(attributes[attr]['to']) && !isset(attributes[attr]['by']) ) { return false; // note return; nothing to animate to } - + start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr); // To beats by, per SMIL 2.1 spec @@ -167,13 +167,13 @@ Anim.prototype = { if (start.constructor == Array) { end = []; for (var i = 0, len = start.length; i < len; ++i) { - end[i] = start[i] + attributes[attr]['by'][i] * 1; // times 1 to cast "by" + end[i] = start[i] + attributes[attr]['by'][i] * 1; // times 1 to cast "by" } } else { end = start + attributes[attr]['by'] * 1; } } - + this.runtimeAttributes[attr].start = start; this.runtimeAttributes[attr].end = end; @@ -187,13 +187,13 @@ Anim.prototype = { * Constructor for Anim instance. * @method init * @param {String | HTMLElement} el Reference to the element that will be animated - * @param {Object} attributes The attribute(s) to be animated. - * Each attribute is an object with at minimum a "to" or "by" member defined. - * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). + * @param {Object} attributes The attribute(s) to be animated. + * Each attribute is an object with at minimum a "to" or "by" member defined. + * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). * All attribute names use camelCase. * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) - */ + */ init: function(el, attributes, duration, method) { /** * Whether or not the animation is running. @@ -202,7 +202,7 @@ Anim.prototype = { * @type Boolean */ var isAnimated = false; - + /** * A Date object that is created when the animation begins. * @property startTime @@ -210,14 +210,14 @@ Anim.prototype = { * @type Date */ var startTime = null; - + /** * The number of frames this animation was able to execute. * @property actualFrames * @private * @type Int */ - var actualFrames = 0; + var actualFrames = 0; /** * The element to be animated. @@ -226,28 +226,28 @@ Anim.prototype = { * @type HTMLElement */ el = Y.Dom.get(el); - + /** - * The collection of attributes to be animated. - * Each attribute must have at least a "to" or "by" defined in order to animate. - * If "to" is supplied, the animation will end with the attribute at that value. - * If "by" is supplied, the animation will end at that value plus its starting value. - * If both are supplied, "to" is used, and "by" is ignored. + * The collection of attributes to be animated. + * Each attribute must have at least a "to" or "by" defined in order to animate. + * If "to" is supplied, the animation will end with the attribute at that value. + * If "by" is supplied, the animation will end at that value plus its starting value. + * If both are supplied, "to" is used, and "by" is ignored. * Optional additional member include "from" (the value the attribute should start animating from, defaults to current value), and "unit" (the units to apply to the values). * @property attributes * @type Object */ this.attributes = attributes || {}; - + /** * The length of the animation. Defaults to "1" (second). * @property duration * @type Number */ this.duration = !YAHOO.lang.isUndefined(duration) ? duration : 1; - + /** - * The method that will provide values to the attribute(s) during the animation. + * The method that will provide values to the attribute(s) during the animation. * Defaults to "YAHOO.util.Easing.easeNone". * @property method * @type Function @@ -261,7 +261,7 @@ Anim.prototype = { * @type Boolean */ this.useSeconds = true; // default to seconds - + /** * The location of the current animation on the timeline. * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time. @@ -269,7 +269,7 @@ Anim.prototype = { * @type Int */ this.currentFrame = 0; - + /** * The total number of frames to be executed. * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time. @@ -277,7 +277,7 @@ Anim.prototype = { * @type Int */ this.totalFrames = Y.AnimMgr.fps; - + /** * Changes the animated element * @method setEl @@ -285,61 +285,61 @@ Anim.prototype = { this.setEl = function(element) { el = Y.Dom.get(element); }; - + /** * Returns a reference to the animated element. * @method getEl * @return {HTMLElement} */ this.getEl = function() { return el; }; - + /** * Checks whether the element is currently animated. * @method isAnimated - * @return {Boolean} current value of isAnimated. + * @return {Boolean} current value of isAnimated. */ this.isAnimated = function() { return isAnimated; }; - + /** * Returns the animation start time. * @method getStartTime - * @return {Date} current value of startTime. + * @return {Date} current value of startTime. */ this.getStartTime = function() { return startTime; - }; - + }; + this.runtimeAttributes = {}; - - - + + + /** - * Starts the animation by registering it with the animation manager. - * @method animate + * Starts the animation by registering it with the animation manager. + * @method animate */ this.animate = function() { if ( this.isAnimated() ) { return false; } - + this.currentFrame = 0; - + this.totalFrames = ( this.useSeconds ) ? Math.ceil(Y.AnimMgr.fps * this.duration) : this.duration; - - if (this.duration === 0 && this.useSeconds) { // jump to last frame if zero second duration - this.totalFrames = 1; + + if (this.duration === 0 && this.useSeconds) { // jump to last frame if zero second duration + this.totalFrames = 1; } Y.AnimMgr.registerElement(this); return true; }; - + /** * Stops the animation. Normally called by AnimMgr when animation completes. * @method stop * @param {Boolean} finish (optional) If true, animation will jump to final frame. - */ + */ this.stop = function(finish) { if (!this.isAnimated()) { // nothing to stop return false; @@ -351,58 +351,58 @@ Anim.prototype = { } Y.AnimMgr.stop(this); }; - - var onStart = function() { + + var onStart = function() { this.onStart.fire(); - + this.runtimeAttributes = {}; for (var attr in this.attributes) { this.setRuntimeAttribute(attr); } - + isAnimated = true; actualFrames = 0; - startTime = new Date(); + startTime = new Date(); }; - + /** * Feeds the starting and ending values for each animated attribute to doMethod once per frame, then applies the resulting value to the attribute(s). * @private */ - + var onTween = function() { var data = { duration: new Date() - this.getStartTime(), currentFrame: this.currentFrame }; - + data.toString = function() { return ( 'duration: ' + data.duration + ', currentFrame: ' + data.currentFrame ); }; - + this.onTween.fire(data); - + var runtimeAttributes = this.runtimeAttributes; - + for (var attr in runtimeAttributes) { - this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit); + this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit); } - + actualFrames += 1; }; - + var onComplete = function() { var actual_duration = (new Date() - startTime) / 1000 ; - + var data = { duration: actual_duration, frames: actualFrames, fps: actualFrames / actual_duration }; - + data.toString = function() { return ( 'duration: ' + data.duration + @@ -410,38 +410,38 @@ Anim.prototype = { ', fps: ' + data.fps ); }; - + isAnimated = false; actualFrames = 0; this.onComplete.fire(data); }; - + /** * Custom event that fires after onStart, useful in subclassing * @private - */ + */ this._onStart = new Y.CustomEvent('_start', this, true); /** * Custom event that fires when animation begins * Listen via subscribe method (e.g. myAnim.onStart.subscribe(someFunction) * @event onStart - */ + */ this.onStart = new Y.CustomEvent('start', this); - + /** * Custom event that fires between each frame * Listen via subscribe method (e.g. myAnim.onTween.subscribe(someFunction) * @event onTween */ this.onTween = new Y.CustomEvent('tween', this); - + /** * Custom event that fires after onTween * @private */ this._onTween = new Y.CustomEvent('_tween', this, true); - + /** * Custom event that fires when animation ends * Listen via subscribe method (e.g. myAnim.onComplete.subscribe(someFunction) @@ -469,44 +469,44 @@ Anim.prototype = { * @namespace YAHOO.util */ YAHOO.util.AnimMgr = new function() { - /** + /** * Reference to the animation Interval. * @property thread * @private * @type Int */ var thread = null; - - /** + + /** * The current queue of registered animation objects. * @property queue * @private * @type Array - */ + */ var queue = []; - /** + /** * The number of active animations. * @property tweenCount * @private * @type Int - */ + */ var tweenCount = 0; - /** - * Base frame rate (frames per second). + /** + * Base frame rate (frames per second). * Arbitrarily high for better x-browser calibration (slower browsers drop more frames). * @property fps * @type Int - * + * */ this.fps = 1000; - /** + /** * Interval delay in milliseconds, defaults to fastest possible. * @property delay * @type Int - * + * */ this.delay = 1; @@ -522,7 +522,7 @@ YAHOO.util.AnimMgr = new function() { tween._onStart.fire(); this.start(); }; - + /** * removes an animation instance from the animation queue. * All animation instances must be registered in order to animate. @@ -536,7 +536,7 @@ YAHOO.util.AnimMgr = new function() { if (!tween.isAnimated() || index == -1) { return false; } - + tween._onComplete.fire(); queue.splice(index, 1); @@ -547,12 +547,12 @@ YAHOO.util.AnimMgr = new function() { return true; }; - + /** * Starts the animation thread. * Only one thread can run at a time. * @method start - */ + */ this.start = function() { if (thread === null) { thread = setInterval(this.run, this.delay); @@ -564,13 +564,13 @@ YAHOO.util.AnimMgr = new function() { * @method stop * @param {object} tween A specific Anim instance to stop (optional) * If no instance given, Manager stops thread and all animations. - */ + */ this.stop = function(tween) { if (!tween) { clearInterval(thread); - + for (var i = 0, len = queue.length; i < len; ++i) { - this.unRegister(queue[0], 0); + this.unRegister(queue[0], 0); } queue = []; @@ -581,11 +581,11 @@ YAHOO.util.AnimMgr = new function() { this.unRegister(tween); } }; - + /** * Called per Interval to handle each animation frame. * @method run - */ + */ this.run = function() { for (var i = 0, len = queue.length; i < len; ++i) { var tween = queue[i]; @@ -594,16 +594,16 @@ YAHOO.util.AnimMgr = new function() { if (tween.currentFrame < tween.totalFrames || tween.totalFrames === null) { tween.currentFrame += 1; - + if (tween.useSeconds) { correctFrame(tween); } - tween._onTween.fire(); + tween._onTween.fire(); } else { YAHOO.util.AnimMgr.stop(tween, i); } } }; - + var getIndex = function(anim) { for (var i = 0, len = queue.length; i < len; ++i) { if (queue[i] == anim) { @@ -612,7 +612,7 @@ YAHOO.util.AnimMgr = new function() { } return -1; }; - + /** * On the fly frame correction to keep animation on time. * @method correctFrame @@ -625,18 +625,18 @@ YAHOO.util.AnimMgr = new function() { var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames); var elapsed = (new Date() - tween.getStartTime()); var tweak = 0; - + if (elapsed < tween.duration * 1000) { // check if falling behind tweak = Math.round((elapsed / expected - 1) * tween.currentFrame); } else { // went over duration, so jump to end - tweak = frames - (frame + 1); + tweak = frames - (frame + 1); } if (tweak > 0 && isFinite(tweak)) { // adjust if needed if (tween.currentFrame + tweak >= frames) {// dont go past last frame tweak = frames - (frame + 1); } - - tween.currentFrame += tweak; + + tween.currentFrame += tweak; } }; }; @@ -652,35 +652,35 @@ YAHOO.util.Bezier = new function() { * Each point is an array of "x" and "y" values (0 = x, 1 = y) * At least 2 points are required (start and end). * First point is start. Last point is end. - * Additional control points are optional. + * Additional control points are optional. * @method getPosition * @param {Array} points An array containing Bezier points * @param {Number} t A number between 0 and 1 which is the basis for determining current position * @return {Array} An array containing int x and y member data */ - this.getPosition = function(points, t) { + this.getPosition = function(points, t) { var n = points.length; var tmp = []; for (var i = 0; i < n; ++i){ tmp[i] = [points[i][0], points[i][1]]; // save input } - + for (var j = 1; j < n; ++j) { for (i = 0; i < n - j; ++i) { tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0]; - tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1]; + tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1]; } } - - return [ tmp[0][0], tmp[0][1] ]; - + + return [ tmp[0][0], tmp[0][1] ]; + }; }; (function() { /** * Anim subclass for color transitions. - * <p>Usage: <code>var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut);</code> Color values can be specified with either 112233, #112233, + * <p>Usage: <code>var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut);</code> Color values can be specified with either 112233, #112233, * [255,255,255], or rgb(255,255,255)</p> * @class ColorAnim * @namespace YAHOO.util @@ -703,7 +703,7 @@ YAHOO.util.Bezier = new function() { var ColorAnim = function(el, attributes, duration, method) { ColorAnim.superclass.constructor.call(this, el, attributes, duration, method); }; - + ColorAnim.NAME = 'ColorAnim'; // shorthand @@ -712,13 +712,13 @@ YAHOO.util.Bezier = new function() { var superclass = ColorAnim.superclass; var proto = ColorAnim.prototype; - + proto.patterns.color = /color$/i; proto.patterns.rgb = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i; proto.patterns.hex = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i; proto.patterns.hex3 = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i; proto.patterns.transparent = /^transparent|rgba\(0, 0, 0, 0\)$/; // need rgba for safari - + /** * Attempts to parse the given string and return a 3-tuple. * @method parseColor @@ -727,22 +727,22 @@ YAHOO.util.Bezier = new function() { */ proto.parseColor = function(s) { if (s.length == 3) { return s; } - + var c = this.patterns.hex.exec(s); if (c && c.length == 4) { return [ parseInt(c[1], 16), parseInt(c[2], 16), parseInt(c[3], 16) ]; } - + c = this.patterns.rgb.exec(s); if (c && c.length == 4) { return [ parseInt(c[1], 10), parseInt(c[2], 10), parseInt(c[3], 10) ]; } - + c = this.patterns.hex3.exec(s); if (c && c.length == 4) { return [ parseInt(c[1] + c[1], 16), parseInt(c[2] + c[2], 16), parseInt(c[3] + c[3], 16) ]; } - + return null; }; @@ -750,11 +750,11 @@ YAHOO.util.Bezier = new function() { var el = this.getEl(); if ( this.patterns.color.test(attr) ) { var val = YAHOO.util.Dom.getStyle(el, attr); - + if (this.patterns.transparent.test(val)) { // bgcolor default var parent = el.parentNode; // try and get from an ancestor val = Y.Dom.getStyle(parent, attr); - + while (parent && this.patterns.transparent.test(val)) { parent = parent.parentNode; val = Y.Dom.getStyle(parent, attr); @@ -769,16 +769,16 @@ YAHOO.util.Bezier = new function() { return val; }; - + proto.doMethod = function(attr, start, end) { var val; - + if ( this.patterns.color.test(attr) ) { val = []; for (var i = 0, len = start.length; i < len; ++i) { val[i] = superclass.doMethod.call(this, attr, start[i], end[i]); } - + val = 'rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')'; } else { @@ -790,7 +790,7 @@ YAHOO.util.Bezier = new function() { proto.setRuntimeAttribute = function(attr) { superclass.setRuntimeAttribute.call(this, attr); - + if ( this.patterns.color.test(attr) ) { var attributes = this.attributes; var start = this.parseColor(this.runtimeAttributes[attr].start); @@ -798,12 +798,12 @@ YAHOO.util.Bezier = new function() { // fix colors if going "by" if ( typeof attributes[attr]['to'] === 'undefined' && typeof attributes[attr]['by'] !== 'undefined' ) { end = this.parseColor(attributes[attr].by); - + for (var i = 0, len = start.length; i < len; ++i) { end[i] = start[i] + end[i]; } } - + this.runtimeAttributes[attr].start = start; this.runtimeAttributes[attr].end = end; } @@ -845,7 +845,7 @@ YAHOO.util.Easing = { easeNone: function (t, b, c, d) { return c*t/d + b; }, - + /** * Begins slowly and accelerates towards end. (quadratic) * @method easeIn @@ -871,7 +871,7 @@ YAHOO.util.Easing = { easeOut: function (t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, - + /** * Begins slowly and decelerates towards end. (quadratic) * @method easeBoth @@ -885,10 +885,10 @@ YAHOO.util.Easing = { if ((t/=d/2) < 1) { return c/2*t*t + b; } - + return -c/2 * ((--t)*(t-2) - 1) + b; }, - + /** * Begins slowly and accelerates towards end. (quartic) * @method easeInStrong @@ -901,7 +901,7 @@ YAHOO.util.Easing = { easeInStrong: function (t, b, c, d) { return c*(t/=d)*t*t*t + b; }, - + /** * Begins quickly and decelerates towards end. (quartic) * @method easeOutStrong @@ -914,7 +914,7 @@ YAHOO.util.Easing = { easeOutStrong: function (t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, - + /** * Begins slowly and decelerates towards end. (quartic) * @method easeBothStrong @@ -928,7 +928,7 @@ YAHOO.util.Easing = { if ((t/=d/2) < 1) { return c/2*t*t*t*t + b; } - + return -c/2 * ((t-=2)*t*t*t - 2) + b; }, @@ -954,15 +954,15 @@ YAHOO.util.Easing = { if (!p) { p=d*.3; } - + if (!a || a < Math.abs(c)) { - a = c; + a = c; var s = p/4; } else { var s = p/(2*Math.PI) * Math.asin (c/a); } - + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; }, @@ -987,7 +987,7 @@ YAHOO.util.Easing = { if (!p) { p=d*.3; } - + if (!a || a < Math.abs(c)) { a = c; var s = p / 4; @@ -995,10 +995,10 @@ YAHOO.util.Easing = { else { var s = p/(2*Math.PI) * Math.asin (c/a); } - + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }, - + /** * Snap both elastic effect. * @method elasticBoth @@ -1014,28 +1014,28 @@ YAHOO.util.Easing = { if (t == 0) { return b; } - + if ( (t /= d/2) == 2 ) { return b+c; } - + if (!p) { p = d*(.3*1.5); } - + if ( !a || a < Math.abs(c) ) { - a = c; + a = c; var s = p/4; } else { var s = p/(2*Math.PI) * Math.asin (c/a); } - + if (t < 1) { - return -.5*(a*Math.pow(2,10*(t-=1)) * + return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; } - return a*Math.pow(2,-10*(t-=1)) * + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; }, @@ -1073,9 +1073,9 @@ YAHOO.util.Easing = { } return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, - + /** - * Backtracks slightly, then reverses direction, overshoots end, + * Backtracks slightly, then reverses direction, overshoots end, * then reverses and comes back to end. * @method backBoth * @param {Number} t Time value used to compute current value @@ -1087,9 +1087,9 @@ YAHOO.util.Easing = { */ backBoth: function (t, b, c, d, s) { if (typeof s == 'undefined') { - s = 1.70158; + s = 1.70158; } - + if ((t /= d/2 ) < 1) { return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; } @@ -1108,7 +1108,7 @@ YAHOO.util.Easing = { bounceIn: function (t, b, c, d) { return c - YAHOO.util.Easing.bounceOut(d-t, 0, c, d) + b; }, - + /** * Bounces off end. * @method bounceOut @@ -1128,7 +1128,7 @@ YAHOO.util.Easing = { } return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; }, - + /** * Bounces off start and end. * @method bounceBoth @@ -1148,7 +1148,7 @@ YAHOO.util.Easing = { (function() { /** - * Anim subclass for moving elements along a path defined by the "points" + * Anim subclass for moving elements along a path defined by the "points" * member of "attributes". All "points" are arrays with x, y coordinates. * <p>Usage: <code>var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);</code></p> * @class Motion @@ -1159,13 +1159,13 @@ YAHOO.util.Easing = { * @requires YAHOO.util.Bezier * @requires YAHOO.util.Dom * @requires YAHOO.util.Event - * @requires YAHOO.util.CustomEvent + * @requires YAHOO.util.CustomEvent * @constructor * @extends YAHOO.util.ColorAnim * @param {String | HTMLElement} el Reference to the element that will be animated - * @param {Object} attributes The attribute(s) to be animated. - * Each attribute is an object with at minimum a "to" or "by" member defined. - * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). + * @param {Object} attributes The attribute(s) to be animated. + * Each attribute is an object with at minimum a "to" or "by" member defined. + * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). * All attribute names use camelCase. * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) @@ -1182,12 +1182,12 @@ YAHOO.util.Easing = { // shorthand var Y = YAHOO.util; YAHOO.extend(Motion, Y.ColorAnim); - + var superclass = Motion.superclass; var proto = Motion.prototype; proto.patterns.points = /^points$/i; - + proto.setAttribute = function(attr, val, unit) { if ( this.patterns.points.test(attr) ) { unit = unit || 'px'; @@ -1215,7 +1215,7 @@ YAHOO.util.Easing = { var val = null; if ( this.patterns.points.test(attr) ) { - var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100; + var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100; val = Y.Bezier.getPosition(this.runtimeAttributes[attr], t); } else { val = superclass.doMethod.call(this, attr, start, end); @@ -1231,11 +1231,11 @@ YAHOO.util.Easing = { var control = attributes['points']['control'] || []; var end; var i, len; - + if (control.length > 0 && !(control[0] instanceof Array) ) { // could be single point or array of points control = [control]; } else { // break reference to attributes.points.control - var tmp = []; + var tmp = []; for (i = 0, len = control.length; i< len; ++i) { tmp[i] = control[i]; } @@ -1245,36 +1245,36 @@ YAHOO.util.Easing = { if (Y.Dom.getStyle(el, 'position') == 'static') { // default to relative Y.Dom.setStyle(el, 'position', 'relative'); } - + if ( isset(attributes['points']['from']) ) { Y.Dom.setXY(el, attributes['points']['from']); // set position to from point - } + } else { Y.Dom.setXY( el, Y.Dom.getXY(el) ); } // set it to current position - + start = this.getAttribute('points'); // get actual top & left - + // TO beats BY, per SMIL 2.1 spec if ( isset(attributes['points']['to']) ) { end = translateValues.call(this, attributes['points']['to'], start); - + var pageXY = Y.Dom.getXY(this.getEl()); for (i = 0, len = control.length; i < len; ++i) { control[i] = translateValues.call(this, control[i], start); } - + } else if ( isset(attributes['points']['by']) ) { end = [ start[0] + attributes['points']['by'][0], start[1] + attributes['points']['by'][1] ]; - + for (i = 0, len = control.length; i < len; ++i) { control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ]; } } this.runtimeAttributes[attr] = [start]; - + if (control.length > 0) { - this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control); + this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control); } this.runtimeAttributes[attr][this.runtimeAttributes[attr].length] = end; @@ -1283,14 +1283,14 @@ YAHOO.util.Easing = { superclass.setRuntimeAttribute.call(this, attr); } }; - + var translateValues = function(val, start) { var pageXY = Y.Dom.getXY(this.getEl()); val = [ val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1] ]; - return val; + return val; }; - + var isset = function(prop) { return (typeof prop !== 'undefined'); }; @@ -1310,13 +1310,13 @@ YAHOO.util.Easing = { * @requires YAHOO.util.Bezier * @requires YAHOO.util.Dom * @requires YAHOO.util.Event - * @requires YAHOO.util.CustomEvent + * @requires YAHOO.util.CustomEvent * @extends YAHOO.util.ColorAnim * @constructor * @param {String or HTMLElement} el Reference to the element that will be animated - * @param {Object} attributes The attribute(s) to be animated. - * Each attribute is an object with at minimum a "to" or "by" member defined. - * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). + * @param {Object} attributes The attribute(s) to be animated. + * Each attribute is an object with at minimum a "to" or "by" member defined. + * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). * All attribute names use camelCase. * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) @@ -1332,19 +1332,19 @@ YAHOO.util.Easing = { // shorthand var Y = YAHOO.util; YAHOO.extend(Scroll, Y.ColorAnim); - + var superclass = Scroll.superclass; var proto = Scroll.prototype; proto.doMethod = function(attr, start, end) { var val = null; - + if (attr == 'scroll') { val = [ this.method(this.currentFrame, start[0], end[0] - start[0], this.totalFrames), this.method(this.currentFrame, start[1], end[1] - start[1], this.totalFrames) ]; - + } else { val = superclass.doMethod.call(this, attr, start, end); } @@ -1354,19 +1354,19 @@ YAHOO.util.Easing = { proto.getAttribute = function(attr) { var val = null; var el = this.getEl(); - + if (attr == 'scroll') { val = [ el.scrollLeft, el.scrollTop ]; } else { val = superclass.getAttribute.call(this, attr); } - + return val; }; proto.setAttribute = function(attr, val, unit) { var el = this.getEl(); - + if (attr == 'scroll') { el.scrollLeft = val[0]; el.scrollTop = val[1];
