fixed the resizable text area with IE problem fixed the ad space with IE problem merged the 7.2.0 and 7.1.4 change logs
348 lines
9.2 KiB
HTML
348 lines
9.2 KiB
HTML
|
|
<html>
|
|
<head>
|
|
<title>
|
|
JavaScript Documentation -
|
|
|
|
AnimMgr.js
|
|
|
|
</title>
|
|
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="header">
|
|
<h1>JavaScript Documentation</h1>
|
|
<h3><a href="./index.html">Animation Utility</a></h3>
|
|
|
|
<div class="breadcrumbs">
|
|
|
|
<a href="javascript: alert('This location is TBD');">Home</a>
|
|
>
|
|
|
|
|
|
|
|
|
|
<a href="./index.html">Animation Utility</a>
|
|
>
|
|
<strong>AnimMgr.js</strong>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div id="body">
|
|
|
|
|
|
<div class="nav">
|
|
<div class="module resources">
|
|
<ul class="content">
|
|
<li><a href="overview-tree.html">Tree View</a></li>
|
|
<li><a href="index-all.html">Element Index</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
<div class="module">
|
|
<h4><a href="./allclasses-noframe.html">Classes</a></h4>
|
|
<ul class="content">
|
|
|
|
<li>
|
|
<a href="YAHOO.util.html">
|
|
YAHOO.util</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="YAHOO.util.Anim.html">
|
|
YAHOO.util.Anim</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="YAHOO.util.AnimMgr.html">
|
|
YAHOO.util.AnimMgr</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="YAHOO.util.Bezier.html">
|
|
YAHOO.util.Bezier</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="module">
|
|
<h4><a href="./overview-summary.html">Files</a></h4>
|
|
<ul class="content">
|
|
|
|
<li>
|
|
<a href="overview-summary-Anim.js.html">
|
|
Anim.js</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="overview-summary-AnimMgr.js.html">
|
|
AnimMgr.js</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="overview-summary-Bezier.js.html">
|
|
Bezier.js</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="overview-summary-ColorAnim.js.html">
|
|
ColorAnim.js</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="overview-summary-Easing.js.html">
|
|
Easing.js</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="overview-summary-Motion.js.html">
|
|
Motion.js</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="overview-summary-Scroll.js.html">
|
|
Scroll.js</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="main">
|
|
|
|
|
|
|
|
|
|
<h2>AnimMgr.js</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="meta">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="section source">
|
|
<h3><a name="source">Souce Code</a> <span class="top">[<a href="#top">top</a>]</span></h3>
|
|
<pre class="sourceview"><span class="comment">/*
|
|
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
|
|
Code licensed under the BSD License:
|
|
http://developer.yahoo.net/yui/license.txt
|
|
Version: 0.10.0
|
|
*/</span>
|
|
|
|
<span class="comment">/**
|
|
* <span class="attrib">@class</span> Handles animation queueing and threading.
|
|
* Used by Anim and subclasses.
|
|
*/</span>
|
|
YAHOO.util.AnimMgr = new <span class="reserved">function</span>() {
|
|
<span class="comment">/**
|
|
* Reference to the animation Interval
|
|
* <span class="attrib">@private</span>
|
|
* <span class="attrib">@type</span> Int
|
|
*/</span>
|
|
var thread = null;
|
|
|
|
<span class="comment">/**
|
|
* The current queue of registered animation objects.
|
|
* <span class="attrib">@private</span>
|
|
* <span class="attrib">@type</span> Array
|
|
*/</span>
|
|
var queue = [];
|
|
|
|
<span class="comment">/**
|
|
* The number of active animations.
|
|
* <span class="attrib">@private</span>
|
|
* <span class="attrib">@type</span> Int
|
|
*/</span>
|
|
var tweenCount = 0;
|
|
|
|
<span class="comment">/**
|
|
* Base frame rate (frames per second).
|
|
* Arbitrarily high for better x-browser calibration (slower browsers drop more frames).
|
|
* <span class="attrib">@type</span> Int
|
|
*
|
|
*/</span>
|
|
<span class="reserved">this</span>.fps = 200;
|
|
|
|
<span class="comment">/**
|
|
* Interval delay in milliseconds, defaults to fastest possible.
|
|
* <span class="attrib">@type</span> Int
|
|
*
|
|
*/</span>
|
|
<span class="reserved">this</span>.delay = 1;
|
|
|
|
<span class="comment">/**
|
|
* Adds an animation instance to the animation queue.
|
|
* All animation instances must be registered in order to animate.
|
|
* <span class="attrib">@param</span> {object} tween The Anim instance to be be registered
|
|
*/</span>
|
|
<span class="reserved">this</span>.registerElement = <span class="reserved">function</span>(tween) {
|
|
queue[queue.length] = tween;
|
|
tweenCount += 1;
|
|
tween._onStart.fire();
|
|
<span class="reserved">this</span>.start();
|
|
};
|
|
|
|
<span class="reserved">this</span>.unRegister = <span class="reserved">function</span>(tween, index) {
|
|
tween._onComplete.fire();
|
|
index = index || getIndex(tween);
|
|
<span class="reserved">if</span> (index != -1) { queue.splice(index, 1); }
|
|
|
|
tweenCount -= 1;
|
|
<span class="reserved">if</span> (tweenCount <= 0) { <span class="reserved">this</span>.stop(); }
|
|
};
|
|
|
|
<span class="comment">/**
|
|
* Starts the animation thread.
|
|
* Only one thread can run at a time.
|
|
*/</span>
|
|
<span class="reserved">this</span>.start = <span class="reserved">function</span>() {
|
|
<span class="reserved">if</span> (thread === null) { thread = setInterval(<span class="reserved">this</span>.run, <span class="reserved">this</span>.delay); }
|
|
};
|
|
|
|
<span class="comment">/**
|
|
* Stops the animation thread or a specific animation instance.
|
|
* <span class="attrib">@param</span> {object} tween A specific Anim instance to stop (optional)
|
|
* If no instance given, Manager stops thread and all animations.
|
|
*/</span>
|
|
<span class="reserved">this</span>.stop = <span class="reserved">function</span>(tween) {
|
|
<span class="reserved">if</span> (!tween) {
|
|
clearInterval(thread);
|
|
<span class="reserved">for</span> (var i = 0, len = queue.length; i < len; ++i) {
|
|
<span class="reserved">if</span> (queue[i].isAnimated()) {
|
|
<span class="reserved">this</span>.unRegister(tween, i);
|
|
}
|
|
}
|
|
queue = [];
|
|
thread = null;
|
|
tweenCount = 0;
|
|
}
|
|
<span class="reserved">else</span> {
|
|
<span class="reserved">this</span>.unRegister(tween);
|
|
}
|
|
};
|
|
|
|
<span class="comment">/**
|
|
* Called per Interval to handle each animation frame.
|
|
*/</span>
|
|
<span class="reserved">this</span>.run = <span class="reserved">function</span>() {
|
|
<span class="reserved">for</span> (var i = 0, len = queue.length; i < len; ++i) {
|
|
var tween = queue[i];
|
|
<span class="reserved">if</span> ( !tween || !tween.isAnimated() ) { continue; }
|
|
|
|
<span class="reserved">if</span> (tween.currentFrame < tween.totalFrames || tween.totalFrames === null)
|
|
{
|
|
tween.currentFrame += 1;
|
|
|
|
<span class="reserved">if</span> (tween.useSeconds) {
|
|
correctFrame(tween);
|
|
}
|
|
tween._onTween.fire();
|
|
}
|
|
<span class="reserved">else</span> { YAHOO.util.AnimMgr.stop(tween, i); }
|
|
}
|
|
};
|
|
|
|
var getIndex = <span class="reserved">function</span>(anim) {
|
|
<span class="reserved">for</span> (var i = 0, len = queue.length; i < len; ++i) {
|
|
<span class="reserved">if</span> (queue[i] == anim) {
|
|
<span class="reserved">return</span> i; <span class="comment">// note return;</span>
|
|
}
|
|
}
|
|
<span class="reserved">return</span> -1;
|
|
};
|
|
|
|
<span class="comment">/**
|
|
* On the fly frame correction to keep animation on time.
|
|
* <span class="attrib">@private</span>
|
|
* <span class="attrib">@param</span> {Object} tween The Anim instance being corrected.
|
|
*/</span>
|
|
var correctFrame = <span class="reserved">function</span>(tween) {
|
|
var frames = tween.totalFrames;
|
|
var frame = tween.currentFrame;
|
|
var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames);
|
|
var elapsed = (new Date() - tween.getStartTime());
|
|
var tweak = 0;
|
|
|
|
<span class="reserved">if</span> (elapsed < tween.duration * 1000) { <span class="comment">// check if falling behind</span>
|
|
tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);
|
|
} <span class="reserved">else</span> { <span class="comment">// went over duration, so jump to end</span>
|
|
tweak = frames - (frame + 1);
|
|
}
|
|
<span class="reserved">if</span> (tweak > 0 && isFinite(tweak)) { <span class="comment">// adjust if needed</span>
|
|
<span class="reserved">if</span> (tween.currentFrame + tweak >= frames) {<span class="comment">// dont go past last frame</span>
|
|
tweak = frames - (frame + 1);
|
|
}
|
|
|
|
tween.currentFrame += tweak;
|
|
}
|
|
};
|
|
};
|
|
</pre>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div id="footer">
|
|
<hr />
|
|
Copyright © 2004 - 2005 Yahoo! Inc. All rights reserved.
|
|
<br />
|
|
Yahoo! Confidential.
|
|
<br /><br />
|
|
Documentation generated by <a href="http://jsdoc.sourceforge.net/">JSDoc</a>
|
|
version 1.9.5.8
|
|
</div>
|
|
|
|
|
|
</body>
|
|
</html>
|