4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-fx-Easing'>/**
19 </span> * @class Ext.fx.Easing
21 * This class contains a series of function definitions used to modify values during an animation.
22 * They describe how the intermediate values used during a transition will be calculated. It allows for a transition to change
23 * speed over its duration. The following options are available:
25 * - linear The default easing type
36 * - cubic-bezier(x1, y1, x2, y2)
38 * Note that cubic-bezier will create a custom easing curve following the CSS3 [transition-timing-function][0]
39 * specification. The four values specify points P1 and P2 of the curve as (x1, y1, x2, y2). All values must
40 * be in the range [0, 1] or the definition is invalid.
42 * [0]: http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag
48 Ext.require('Ext.fx.CubicBezier', function() {
57 // ease: Ext.fx.CubicBezier.cubicBezier(0.25, 0.1, 0.25, 1),
58 // linear: Ext.fx.CubicBezier.cubicBezier(0, 0, 1, 1),
59 // 'ease-in': Ext.fx.CubicBezier.cubicBezier(0.42, 0, 1, 1),
60 // 'ease-out': Ext.fx.CubicBezier.cubicBezier(0, 0.58, 1, 1),
61 // 'ease-in-out': Ext.fx.CubicBezier.cubicBezier(0.42, 0, 0.58, 1),
62 // 'easeIn': Ext.fx.CubicBezier.cubicBezier(0.42, 0, 1, 1),
63 // 'easeOut': Ext.fx.CubicBezier.cubicBezier(0, 0.58, 1, 1),
64 // 'easeInOut': Ext.fx.CubicBezier.cubicBezier(0.42, 0, 0.58, 1)
67 Ext.apply(Ext.fx.Easing, {
72 var q = 0.07813 - n / 2,
74 Q = sqrt(0.0066 + q * q),
76 X = pow(abs(x), 1/3) * (x < 0 ? -1 : 1),
78 Y = pow(abs(y), 1/3) * (y < 0 ? -1 : 1),
80 return pow(1 - t, 2) * 3 * t * 0.1 + (1 - t) * 3 * t * t + t * t * t;
82 easeIn: function (n) {
85 easeOut: function (n) {
88 easeInOut: function(n) {
89 var q = 0.48 - n / 1.04,
90 Q = sqrt(0.1734 + q * q),
92 X = pow(abs(x), 1/3) * (x < 0 ? -1 : 1),
94 Y = pow(abs(y), 1/3) * (y < 0 ? -1 : 1),
96 return (1 - t) * 3 * t * t + t * t * t;
98 backIn: function (n) {
99 return n * n * ((backInSeed + 1) * n - backInSeed);
101 backOut: function (n) {
103 return n * n * ((backInSeed + 1) * n + backInSeed) + 1;
105 elasticIn: function (n) {
106 if (n === 0 || n === 1) {
111 return pow(2, -10 * n) * sin((n - s) * (2 * pi) / p) + 1;
113 elasticOut: function (n) {
114 return 1 - Ext.fx.Easing.elasticIn(1 - n);
116 bounceIn: function (n) {
117 return 1 - Ext.fx.Easing.bounceOut(1 - n);
119 bounceOut: function (n) {
123 if (n < (1 / p)) {
126 if (n < (2 / p)) {
128 l = s * n * n + 0.75;
130 if (n < (2.5 / p)) {
132 l = s * n * n + 0.9375;
135 l = s * n * n + 0.984375;
142 Ext.apply(Ext.fx.Easing, {
143 'back-in': Ext.fx.Easing.backIn,
144 'back-out': Ext.fx.Easing.backOut,
145 'ease-in': Ext.fx.Easing.easeIn,
146 'ease-out': Ext.fx.Easing.easeOut,
147 'elastic-in': Ext.fx.Easing.elasticIn,
148 'elastic-out': Ext.fx.Easing.elasticIn,
149 'bounce-in': Ext.fx.Easing.bounceIn,
150 'bounce-out': Ext.fx.Easing.bounceOut,
151 'ease-in-out': Ext.fx.Easing.easeInOut