6 description: Contains a set of advanced transitions to be used with any of the Fx Classes.
8 license: MIT-style license.
11 - Easing Equations by Robert Penner, <http://www.robertpenner.com/easing/>, modified and optimized to be used with MooTools.
15 provides: Fx.Transitions
22 getTransition: function(){
23 var trans = this.options.transition || Fx.Transitions.Sine.easeInOut;
24 if (typeof trans == 'string'){
25 var data = trans.split(':');
26 trans = Fx.Transitions;
27 trans = trans[data[0]] || trans[data[0].capitalize()];
28 if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')];
35 Fx.Transition = function(transition, params){
36 params = Array.from(params);
37 var easeIn = function(pos){
38 return transition(pos, params);
40 return Object.append(easeIn, {
42 easeOut: function(pos){
43 return 1 - transition(1 - pos, params);
45 easeInOut: function(pos){
46 return (pos <= 0.5 ? transition(2 * pos, params) : (2 - transition(2 * (1 - pos), params))) / 2;
53 linear: function(zero){
61 Fx.Transitions = new Hash(Fx.Transitions);
65 Fx.Transitions.extend = function(transitions){
66 for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]);
69 Fx.Transitions.extend({
72 return Math.pow(p, x && x[0] || 6);
76 return Math.pow(2, 8 * (p - 1));
80 return 1 - Math.sin(Math.acos(p));
84 return 1 - Math.cos(p * Math.PI / 2);
88 x = x && x[0] || 1.618;
89 return Math.pow(p, 2) * ((x + 1) * p - x);
94 for (var a = 0, b = 1; 1; a += b, b /= 2){
95 if (p >= (7 - 4 * a) / 11){
96 value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2);
103 Elastic: function(p, x){
104 return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x && x[0] || 1) / 3);
109 ['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
110 Fx.Transitions[transition] = new Fx.Transition(function(p){
111 return Math.pow(p, i + 2);