Skip to content

Commit

Permalink
MDL-10336, upgrading YUI to 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
toyomoyo committed Aug 2, 2007
1 parent 75bde3c commit 489a965
Show file tree
Hide file tree
Showing 223 changed files with 134,459 additions and 50,241 deletions.
18 changes: 18 additions & 0 deletions lib/yui/animation/README
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
Animation Release Notes

*** version 2.3.0 ***

* duration of zero now executes 1 frame animation
* added setEl() method to enable reuse
* fixed stop() for multiple animations

*** version 2.2.2 **

* no change

*** version 2.2.1 **

* no change

*** version 2.2.0 **

* Fixed AnimMgr.stop() when called without tween

*** version 0.12.2 ***

* raised AnimMgr.fps to 1000
Expand Down
62 changes: 48 additions & 14 deletions lib/yui/animation/animation-debug.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.0
*/
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 0.12.2
*/

/**
* The animation module provides allows effects to be added to HTMLElements.
* @module animation
Expand Down Expand Up @@ -32,9 +38,10 @@ version: 0.12.2
*/

YAHOO.util.Anim = function(el, attributes, duration, method) {
if (el) {
this.init(el, attributes, duration, method);
if (!el) {
YAHOO.log('element required to create Anim instance', 'error', 'Anim');
}
this.init(el, attributes, duration, method);
};

YAHOO.util.Anim.prototype = {
Expand All @@ -45,7 +52,7 @@ YAHOO.util.Anim.prototype = {
*/
toString: function() {
var el = this.getEl();
var id = el.id || el.tagName;
var id = el.id || el.tagName || el;
return ("Anim " + id);
},

Expand Down Expand Up @@ -155,18 +162,20 @@ YAHOO.util.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];
end[i] = start[i] + attributes[attr]['by'][i] * 1; // times 1 to cast "by"
}
} else {
end = start + attributes[attr]['by'];
end = start + attributes[attr]['by'] * 1;
}
}

this.runtimeAttributes[attr].start = start;
this.runtimeAttributes[attr].end = end;

// set units if needed
this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ? attributes[attr]['unit'] : this.getDefaultUnit(attr);
this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ?
attributes[attr]['unit'] : this.getDefaultUnit(attr);
return true;
},

/**
Expand Down Expand Up @@ -230,7 +239,7 @@ YAHOO.util.Anim.prototype = {
* @property duration
* @type Number
*/
this.duration = duration || 1;
this.duration = !YAHOO.lang.isUndefined(duration) ? duration : 1;

/**
* The method that will provide values to the attribute(s) during the animation.
Expand Down Expand Up @@ -264,6 +273,13 @@ YAHOO.util.Anim.prototype = {
*/
this.totalFrames = YAHOO.util.AnimMgr.fps;

/**
* Changes the animated element
* @method setEl
*/
this.setEl = function(element) {
el = YAHOO.util.Dom.get(element);
};

/**
* Returns a reference to the animated element.
Expand Down Expand Up @@ -310,7 +326,11 @@ YAHOO.util.Anim.prototype = {

this.totalFrames = ( this.useSeconds ) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration;

if (this.duration === 0 && this.useSeconds) {
this.totalFrames = 1; // jump to last frame if no duration
}
YAHOO.util.AnimMgr.registerElement(this);
return true;
};

/**
Expand Down Expand Up @@ -506,10 +526,18 @@ YAHOO.util.AnimMgr = new function() {
this.unRegister = function(tween, index) {
tween._onComplete.fire();
index = index || getIndex(tween);
if (index != -1) { queue.splice(index, 1); }
if (index == -1) {
return false;
}

queue.splice(index, 1);

tweenCount -= 1;
if (tweenCount <= 0) { this.stop(); }
if (tweenCount <= 0) {
this.stop();
}

return true;
};

/**
Expand All @@ -518,7 +546,9 @@ YAHOO.util.AnimMgr = new function() {
* @method start
*/
this.start = function() {
if (thread === null) { thread = setInterval(this.run, this.delay); }
if (thread === null) {
thread = setInterval(this.run, this.delay);
}
};

/**
Expand All @@ -530,11 +560,13 @@ YAHOO.util.AnimMgr = new function() {
this.stop = function(tween) {
if (!tween) {
clearInterval(thread);

for (var i = 0, len = queue.length; i < len; ++i) {
if (queue[i].isAnimated()) {
this.unRegister(tween, i);
if ( queue[0].isAnimated() ) {
this.unRegister(queue[0], 0);
}
}

queue = [];
thread = null;
tweenCount = 0;
Expand Down Expand Up @@ -774,7 +806,8 @@ YAHOO.util.Bezier = new function() {
this.runtimeAttributes[attr].end = end;
}
};
})();/*
})();
/*
TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright 2001 Robert Penner All rights reserved.
Expand Down Expand Up @@ -1343,3 +1376,4 @@ YAHOO.util.Easing = {
}
};
})();
YAHOO.register("animation", YAHOO.util.Anim, {version: "2.3.0", build: "442"});
21 changes: 12 additions & 9 deletions lib/yui/animation/animation-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 489a965

Please sign in to comment.