3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js">// Easing functions
\r
11 // shortcuts to aid compression
\r
19 Ext.apply(EXTLIB.Easing, {
\r
21 easeBoth: function (t, b, c, d) {
\r
22 return ((t /= d / 2) < 1) ? c / 2 * t * t + b : -c / 2 * ((--t) * (t - 2) - 1) + b;
\r
25 easeInStrong: function (t, b, c, d) {
\r
26 return c * (t /= d) * t * t * t + b;
\r
29 easeOutStrong: function (t, b, c, d) {
\r
30 return -c * ((t = t / d - 1) * t * t * t - 1) + b;
\r
33 easeBothStrong: function (t, b, c, d) {
\r
34 return ((t /= d / 2) < 1) ? c / 2 * t * t * t * t + b : -c / 2 * ((t -= 2) * t * t * t - 2) + b;
\r
37 elasticIn: function (t, b, c, d, a, p) {
\r
38 if (t == 0 || (t /= d) == 1) {
\r
39 return t == 0 ? b : b + c;
\r
45 s = p / (2 * pi) * asin(c / a);
\r
51 return -(a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b;
\r
55 elasticOut: function (t, b, c, d, a, p) {
\r
56 if (t == 0 || (t /= d) == 1) {
\r
57 return t == 0 ? b : b + c;
\r
63 s = p / (2 * pi) * asin(c / a);
\r
69 return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p) + c + b;
\r
72 elasticBoth: function (t, b, c, d, a, p) {
\r
73 if (t == 0 || (t /= d / 2) == 2) {
\r
74 return t == 0 ? b : b + c;
\r
77 p = p || (d * (.3 * 1.5));
\r
81 s = p / (2 * pi) * asin(c / a);
\r
88 -.5 * (a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b :
\r
89 a * pow(2, -10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p) * .5 + c + b;
\r
92 backIn: function (t, b, c, d, s) {
\r
94 return c * (t /= d) * t * ((s + 1) * t - s) + b;
\r
98 backOut: function (t, b, c, d, s) {
\r
102 return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
\r
106 backBoth: function (t, b, c, d, s) {
\r
109 return ((t /= d / 2 ) < 1) ?
\r
110 c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b :
\r
111 c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
\r
115 bounceIn: function (t, b, c, d) {
\r
116 return c - EXTLIB.Easing.bounceOut(d - t, 0, c, d) + b;
\r
120 bounceOut: function (t, b, c, d) {
\r
121 if ((t /= d) < (1 / 2.75)) {
\r
122 return c * (7.5625 * t * t) + b;
\r
123 } else if (t < (2 / 2.75)) {
\r
124 return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
\r
125 } else if (t < (2.5 / 2.75)) {
\r
126 return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
\r
128 return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
\r
132 bounceBoth: function (t, b, c, d) {
\r
133 return (t < d / 2) ?
\r
134 EXTLIB.Easing.bounceIn(t * 2, 0, c, d) * .5 + b :
\r
135 EXTLIB.Easing.bounceOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b;
\r
141 var EXTLIB = Ext.lib;
\r
143 EXTLIB.Anim.color = function(el, args, duration, easing, cb, scope) {
\r
144 return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.ColorAnim);
\r
147 EXTLIB.ColorAnim = function(el, attributes, duration, method) {
\r
148 EXTLIB.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
\r
151 Ext.extend(EXTLIB.ColorAnim, EXTLIB.AnimBase);
\r
153 var superclass = EXTLIB.ColorAnim.superclass,
\r
154 colorRE = /color$/i,
\r
155 transparentRE = /^transparent|rgba\(0, 0, 0, 0\)$/,
\r
156 rgbRE = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,
\r
157 hexRE= /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,
\r
158 hex3RE = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i,
\r
159 isset = function(v){
\r
160 return typeof v !== 'undefined';
\r
164 function parseColor(s) {
\r
170 if (s.length == 3) {
\r
174 Ext.each([hexRE, rgbRE, hex3RE], function(re, idx){
\r
175 base = (idx % 2 == 0) ? 16 : 10;
\r
177 if(c && c.length == 4){
\r
178 out = [pi(c[1], base), pi(c[2], base), pi(c[3], base)];
\r
185 Ext.apply(EXTLIB.ColorAnim.prototype, {
\r
186 getAttr : function(attr) {
\r
190 if(colorRE.test(attr)){
\r
191 while(el && transparentRE.test(val = Ext.fly(el).getStyle(attr))){
\r
192 el = el.parentNode;
\r
196 val = superclass.getAttr.call(me, attr);
\r
201 doMethod : function(attr, start, end) {
\r
204 floor = Math.floor,
\r
209 if(colorRE.test(attr)){
\r
212 for(i = 0, len = start.length; i < len; i++) {
\r
214 val[i] = superclass.doMethod.call(me, attr, v, end[i]);
\r
216 val = 'rgb(' + floor(val[0]) + ',' + floor(val[1]) + ',' + floor(val[2]) + ')';
\r
218 val = superclass.doMethod.call(me, attr, start, end);
\r
223 setRunAttr : function(attr) {
\r
225 a = me.attributes[attr],
\r
230 superclass.setRunAttr.call(me, attr);
\r
231 ra = me.runAttrs[attr];
\r
232 if(colorRE.test(attr)){
\r
233 var start = parseColor(ra.start),
\r
234 end = parseColor(ra.end);
\r
236 if(!isset(to) && isset(by)){
\r
237 end = parseColor(by);
\r
238 for(var i=0,len=start.length; i<len; i++) {
\r
239 end[i] = start[i] + end[i];
\r
251 // Scroll Animation
\r
252 var EXTLIB = Ext.lib;
\r
253 EXTLIB.Anim.scroll = function(el, args, duration, easing, cb, scope) {
\r
254 return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.Scroll);
\r
257 EXTLIB.Scroll = function(el, attributes, duration, method) {
\r
259 EXTLIB.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
\r
263 Ext.extend(EXTLIB.Scroll, EXTLIB.ColorAnim);
\r
265 var superclass = EXTLIB.Scroll.superclass,
\r
268 Ext.apply(EXTLIB.Scroll.prototype, {
\r
270 doMethod : function(attr, start, end) {
\r
273 curFrame = me.curFrame,
\r
274 totalFrames = me.totalFrames;
\r
276 if(attr == SCROLL){
\r
277 val = [me.method(curFrame, start[0], end[0] - start[0], totalFrames),
\r
278 me.method(curFrame, start[1], end[1] - start[1], totalFrames)];
\r
280 val = superclass.doMethod.call(me, attr, start, end);
\r
285 getAttr : function(attr) {
\r
288 if (attr == SCROLL) {
\r
289 return [me.el.scrollLeft, me.el.scrollTop];
\r
291 return superclass.getAttr.call(me, attr);
\r
295 setAttr : function(attr, val, unit) {
\r
298 if(attr == SCROLL){
\r
299 me.el.scrollLeft = val[0];
\r
300 me.el.scrollTop = val[1];
\r
302 superclass.setAttr.call(me, attr, val, unit);
\r