3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">/*!
10 * Copyright(c) 2006-2009 Ext JS, LLC
12 * http://www.extjs.com/license
16 // shortcuts to aid compression
\r
24 Ext.apply(EXTLIB.Easing, {
\r
26 easeBoth: function (t, b, c, d) {
\r
27 return ((t /= d / 2) < 1) ? c / 2 * t * t + b : -c / 2 * ((--t) * (t - 2) - 1) + b;
\r
30 easeInStrong: function (t, b, c, d) {
\r
31 return c * (t /= d) * t * t * t + b;
\r
34 easeOutStrong: function (t, b, c, d) {
\r
35 return -c * ((t = t / d - 1) * t * t * t - 1) + b;
\r
38 easeBothStrong: function (t, b, c, d) {
\r
39 return ((t /= d / 2) < 1) ? c / 2 * t * t * t * t + b : -c / 2 * ((t -= 2) * t * t * t - 2) + b;
\r
42 elasticIn: function (t, b, c, d, a, p) {
\r
43 if (t == 0 || (t /= d) == 1) {
\r
44 return t == 0 ? b : b + c;
\r
50 s = p / (2 * pi) * asin(c / a);
\r
56 return -(a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b;
\r
60 elasticOut: function (t, b, c, d, a, p) {
\r
61 if (t == 0 || (t /= d) == 1) {
\r
62 return t == 0 ? b : b + c;
\r
68 s = p / (2 * pi) * asin(c / a);
\r
74 return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p) + c + b;
\r
77 elasticBoth: function (t, b, c, d, a, p) {
\r
78 if (t == 0 || (t /= d / 2) == 2) {
\r
79 return t == 0 ? b : b + c;
\r
82 p = p || (d * (.3 * 1.5));
\r
86 s = p / (2 * pi) * asin(c / a);
\r
93 -.5 * (a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b :
\r
94 a * pow(2, -10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p) * .5 + c + b;
\r
97 backIn: function (t, b, c, d, s) {
\r
99 return c * (t /= d) * t * ((s + 1) * t - s) + b;
\r
103 backOut: function (t, b, c, d, s) {
\r
107 return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
\r
111 backBoth: function (t, b, c, d, s) {
\r
114 return ((t /= d / 2 ) < 1) ?
\r
115 c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b :
\r
116 c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
\r
120 bounceIn: function (t, b, c, d) {
\r
121 return c - EXTLIB.Easing.bounceOut(d - t, 0, c, d) + b;
\r
125 bounceOut: function (t, b, c, d) {
\r
126 if ((t /= d) < (1 / 2.75)) {
\r
127 return c * (7.5625 * t * t) + b;
\r
128 } else if (t < (2 / 2.75)) {
\r
129 return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
\r
130 } else if (t < (2.5 / 2.75)) {
\r
131 return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
\r
133 return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
\r
137 bounceBoth: function (t, b, c, d) {
\r
138 return (t < d / 2) ?
\r
139 EXTLIB.Easing.bounceIn(t * 2, 0, c, d) * .5 + b :
\r
140 EXTLIB.Easing.bounceOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b;
\r
146 var EXTLIB = Ext.lib;
\r
148 EXTLIB.Anim.color = function(el, args, duration, easing, cb, scope) {
\r
149 return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.ColorAnim);
\r
152 EXTLIB.ColorAnim = function(el, attributes, duration, method) {
\r
153 EXTLIB.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
\r
156 Ext.extend(EXTLIB.ColorAnim, EXTLIB.AnimBase);
\r
158 var superclass = EXTLIB.ColorAnim.superclass,
\r
159 colorRE = /color$/i,
\r
160 transparentRE = /^transparent|rgba\(0, 0, 0, 0\)$/,
\r
161 rgbRE = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,
\r
162 hexRE= /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,
\r
163 hex3RE = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i,
\r
164 isset = function(v){
\r
165 return typeof v !== 'undefined';
\r
169 function parseColor(s) {
\r
175 if (s.length == 3) {
\r
179 Ext.each([hexRE, rgbRE, hex3RE], function(re, idx){
\r
180 base = (idx % 2 == 0) ? 16 : 10;
\r
182 if(c && c.length == 4){
\r
183 out = [pi(c[1], base), pi(c[2], base), pi(c[3], base)];
\r
190 Ext.apply(EXTLIB.ColorAnim.prototype, {
\r
191 getAttr : function(attr) {
\r
195 if(colorRE.test(attr)){
\r
196 while(el && transparentRE.test(val = Ext.fly(el).getStyle(attr))){
\r
197 el = el.parentNode;
\r
201 val = superclass.getAttr.call(me, attr);
\r
206 doMethod : function(attr, start, end) {
\r
209 floor = Math.floor;
\r
211 if(colorRE.test(attr)){
\r
214 Ext.each(start, function(v, i) {
\r
215 val[i] = superclass.doMethod.call(me, attr, v, end[i]);
\r
218 val = 'rgb(' + floor(val[0]) + ',' + floor(val[1]) + ',' + floor(val[2]) + ')';
\r
220 val = superclass.doMethod.call(me, attr, start, end);
\r
225 setRunAttr : function(attr) {
\r
227 a = me.attributes[attr],
\r
232 superclass.setRunAttr.call(me, attr);
\r
233 ra = me.runAttrs[attr];
\r
234 if(colorRE.test(attr)){
\r
235 var start = parseColor(ra.start),
\r
236 end = parseColor(ra.end);
\r
238 if(!isset(to) && isset(by)){
\r
239 end = parseColor(by);
\r
240 Ext.each(start, function(item, i){
\r
241 end[i] = item + end[i];
\r
253 // Scroll Animation
\r
254 var EXTLIB = Ext.lib;
\r
255 EXTLIB.Anim.scroll = function(el, args, duration, easing, cb, scope) {
\r
256 return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.Scroll);
\r
259 EXTLIB.Scroll = function(el, attributes, duration, method) {
\r
261 EXTLIB.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
\r
265 Ext.extend(EXTLIB.Scroll, EXTLIB.ColorAnim);
\r
267 var superclass = EXTLIB.Scroll.superclass,
\r
270 Ext.apply(EXTLIB.Scroll.prototype, {
\r
272 doMethod : function(attr, start, end) {
\r
275 curFrame = me.curFrame,
\r
276 totalFrames = me.totalFrames;
\r
278 if(attr == SCROLL){
\r
279 val = [me.method(curFrame, start[0], end[0] - start[0], totalFrames),
\r
280 me.method(curFrame, start[1], end[1] - start[1], totalFrames)];
\r
282 val = superclass.doMethod.call(me, attr, start, end);
\r
287 getAttr : function(attr) {
\r
290 if (attr == SCROLL) {
\r
291 return [me.el.scrollLeft, me.el.scrollTop];
\r
293 return superclass.getAttr.call(me, attr);
\r
297 setAttr : function(attr, val, unit) {
\r
300 if(attr == SCROLL){
\r
301 me.el.scrollLeft = val[0];
\r
302 me.el.scrollTop = val[1];
\r
304 superclass.setAttr.call(me, attr, val, unit);
\r