Skip to content

Commit

Permalink
Fx.Transition optimalization - If you create a new Fx.Transition, wit…
Browse files Browse the repository at this point in the history
…h params, and pass it directly into Fx, the params are ignored, so you explicetely need to use .easeIn, this commit uses the easeIn function by default and respects the passed params
  • Loading branch information
Arian authored and cpojer committed Dec 27, 2010
1 parent 5b1013f commit 1fe8f3a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Source/Fx/Fx.Transitions.js
Expand Up @@ -34,15 +34,16 @@ Fx.implement({

Fx.Transition = function(transition, params){
params = Array.from(params);
return Object.append(transition, {
easeIn: function(pos){
return transition(pos, params);
},
var easeIn = function(pos){
return transition(pos, params);
};
return Object.append(easeIn, {
easeIn: easeIn,
easeOut: function(pos){
return 1 - transition(1 - pos, params);
},
easeInOut: function(pos){
return (pos <= 0.5) ? transition(2 * pos, params) / 2 : (2 - transition(2 * (1 - pos), params)) / 2;
return (pos <= 0.5 ? transition(2 * pos, params) : (2 - transition(2 * (1 - pos), params))) / 2;
}
});
};
Expand Down Expand Up @@ -107,6 +108,6 @@ Fx.Transitions.extend({

['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
Fx.Transitions[transition] = new Fx.Transition(function(p){
return Math.pow(p, [i + 2]);
return Math.pow(p, i + 2);
});
});

0 comments on commit 1fe8f3a

Please sign in to comment.