4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../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
49 Ext.require('Ext.fx.CubicBezier', function() {
58 // ease: Ext.fx.CubicBezier.cubicBezier(0.25, 0.1, 0.25, 1),
59 // linear: Ext.fx.CubicBezier.cubicBezier(0, 0, 1, 1),
60 // 'ease-in': Ext.fx.CubicBezier.cubicBezier(0.42, 0, 1, 1),
61 // 'ease-out': Ext.fx.CubicBezier.cubicBezier(0, 0.58, 1, 1),
62 // 'ease-in-out': Ext.fx.CubicBezier.cubicBezier(0.42, 0, 0.58, 1),
63 // 'easeIn': Ext.fx.CubicBezier.cubicBezier(0.42, 0, 1, 1),
64 // 'easeOut': Ext.fx.CubicBezier.cubicBezier(0, 0.58, 1, 1),
65 // 'easeInOut': Ext.fx.CubicBezier.cubicBezier(0.42, 0, 0.58, 1)
68 Ext.apply(Ext.fx.Easing, {
73 var q = 0.07813 - n / 2,
75 Q = sqrt(0.0066 + q * q),
77 X = pow(abs(x), 1/3) * (x < 0 ? -1 : 1),
79 Y = pow(abs(y), 1/3) * (y < 0 ? -1 : 1),
81 return pow(1 - t, 2) * 3 * t * 0.1 + (1 - t) * 3 * t * t + t * t * t;
83 easeIn: function (n) {
86 easeOut: function (n) {
89 easeInOut: function(n) {
90 var q = 0.48 - n / 1.04,
91 Q = sqrt(0.1734 + q * q),
93 X = pow(abs(x), 1/3) * (x < 0 ? -1 : 1),
95 Y = pow(abs(y), 1/3) * (y < 0 ? -1 : 1),
97 return (1 - t) * 3 * t * t + t * t * t;
99 backIn: function (n) {
100 return n * n * ((backInSeed + 1) * n - backInSeed);
102 backOut: function (n) {
104 return n * n * ((backInSeed + 1) * n + backInSeed) + 1;
106 elasticIn: function (n) {
107 if (n === 0 || n === 1) {
112 return pow(2, -10 * n) * sin((n - s) * (2 * pi) / p) + 1;
114 elasticOut: function (n) {
115 return 1 - Ext.fx.Easing.elasticIn(1 - n);
117 bounceIn: function (n) {
118 return 1 - Ext.fx.Easing.bounceOut(1 - n);
120 bounceOut: function (n) {
124 if (n < (1 / p)) {
127 if (n < (2 / p)) {
129 l = s * n * n + 0.75;
131 if (n < (2.5 / p)) {
133 l = s * n * n + 0.9375;
136 l = s * n * n + 0.984375;
143 Ext.apply(Ext.fx.Easing, {
144 'back-in': Ext.fx.Easing.backIn,
145 'back-out': Ext.fx.Easing.backOut,
146 'ease-in': Ext.fx.Easing.easeIn,
147 'ease-out': Ext.fx.Easing.easeOut,
148 'elastic-in': Ext.fx.Easing.elasticIn,
149 'elastic-out': Ext.fx.Easing.elasticIn,
150 'bounce-in': Ext.fx.Easing.bounceIn,
151 'bounce-out': Ext.fx.Easing.bounceOut,
152 'ease-in-out': Ext.fx.Easing.easeInOut