diff --git a/compiled/radium.js b/compiled/radium.js index ebf502b..bf3a373 100644 --- a/compiled/radium.js +++ b/compiled/radium.js @@ -247,7 +247,7 @@ })(); Engine.prototype.ease = { - _calculateElasticValues: function(amplitude, period, change, inout) { + _calculateElasticValues: function(duration, amplitude, period, change, inout) { var overshoot; if (inout == null) { inout = false; @@ -322,7 +322,6 @@ if (invert_repeat == null) { invert_repeat = false; } - console.log("this", this.engine); return new Ease(this.engine, "bounceOut", infinite, start, end, this.engine.current_frame, duration, invert_repeat, next); }, bounceIn: function(start, end, duration, next, infinite, invert_repeat) { @@ -438,7 +437,7 @@ if (period == null) { period = null; } - _ref = this._calculateElasticValues(amplitude, period, end - start), amplitude = _ref[0], period = _ref[1], change = _ref[2], overshoot = _ref[3]; + _ref = this._calculateElasticValues(duration, amplitude, period, end - start), amplitude = _ref[0], period = _ref[1], change = _ref[2], overshoot = _ref[3]; end = start + change; return new Ease(this.engine, "elasticOut", infinite, start, end, this.engine.current_frame, duration, invert_repeat, next, amplitude, period, overshoot); }, @@ -459,7 +458,7 @@ if (period == null) { period = null; } - _ref = this._calculateElasticValues(amplitude, period, end - start), amplitude = _ref[0], period = _ref[1], change = _ref[2], overshoot = _ref[3]; + _ref = this._calculateElasticValues(duration, amplitude, period, end - start), amplitude = _ref[0], period = _ref[1], change = _ref[2], overshoot = _ref[3]; end = start + change; return new Ease(this.engine, "elasticIn", infinite, start, end, this.engine.current_frame, duration, invert_repeat, next, amplitude, period, overshoot); }, @@ -480,7 +479,7 @@ if (period == null) { period = null; } - _ref = this._calculateElasticValues(amplitude, period, end - start, true), amplitude = _ref[0], period = _ref[1], change = _ref[2], overshoot = _ref[3]; + _ref = this._calculateElasticValues(duration, amplitude, period, end - start, true), amplitude = _ref[0], period = _ref[1], change = _ref[2], overshoot = _ref[3]; end = start + change; return new Ease(this.engine, "elasticInOut", infinite, start, end, this.engine.current_frame, duration, invert_repeat, next, amplitude, period, overshoot); }, @@ -852,7 +851,7 @@ }; Ease.prototype.cubicInOut = function(time) { - time = time / (duration / 2); + time = time / (this.duration / 2); if (time < 1) { return change / 2 * time * time * time + this.start; } else { @@ -863,7 +862,7 @@ Ease.prototype.elasticOut = function(time) { var amplitude, overshoot, period; - time = time / duration; + time = time / this.duration; amplitude = this.params[0]; period = this.params[1]; overshoot = this.params[2]; @@ -872,7 +871,7 @@ Ease.prototype.elasticIn = function(time) { var amplitude, overshoot, period; - time = time / duration; + time = time / this.duration; amplitude = this.params[0]; period = this.params[1]; overshoot = this.params[2]; @@ -881,7 +880,7 @@ Ease.prototype.elasticInOut = function(time) { var amplitude, overshoot, period; - time = time / (duration / 2) - 1; + time = time / (this.duration / 2) - 1; amplitude = this.params[0]; period = this.params[1]; overshoot = this.params[2]; diff --git a/radium/engine.ease.coffee b/radium/engine.ease.coffee index 5e13807..44168bd 100644 --- a/radium/engine.ease.coffee +++ b/radium/engine.ease.coffee @@ -1,5 +1,5 @@ Engine::ease = - _calculateElasticValues: (amplitude, period, change, inout = false) -> + _calculateElasticValues: (duration, amplitude, period, change, inout = false) -> if !period? if inout period = duration * (0.3 * 1.5) @@ -21,7 +21,6 @@ Engine::ease = backInOut: (start, end, duration, next = null, infinite = false , invert_repeat = false, overshoot = 1.70158) -> return new Ease(this.engine, "backInOut", infinite, start, end, @engine.current_frame, duration, invert_repeat, next, overshoot) bounceOut: (start, end, duration, next = null, infinite = false , invert_repeat = false) -> - console.log("this", this.engine) return new Ease(this.engine, "bounceOut", infinite, start, end, @engine.current_frame, duration, invert_repeat, next) bounceIn: (start, end, duration, next = null, infinite = false , invert_repeat = false) -> return new Ease(this.engine, "bounceIn", infinite, start, end, @engine.current_frame, duration, invert_repeat, next) @@ -40,15 +39,15 @@ Engine::ease = cubicInOut: (start, end, duration, next = null, infinite = false , invert_repeat = false) -> return new Ease(this.engine, "cubicInOut", infinite, start, end, @engine.current_frame, duration, invert_repeat, next) elasticOut: (start, end, duration, next = null, infinite = false , invert_repeat = false, amplitude = null, period = null) -> - [amplitude, period, change, overshoot] = @_calculateElasticValues(amplitude, period, end - start) + [amplitude, period, change, overshoot] = @_calculateElasticValues(duration, amplitude, period, end - start) end = start + change return new Ease(this.engine, "elasticOut", infinite, start, end, @engine.current_frame, duration, invert_repeat, next, amplitude, period, overshoot) elasticIn: (start, end, duration, next = null, infinite = false , invert_repeat = false, amplitude = null, period = null) -> - [amplitude, period, change, overshoot] = @_calculateElasticValues(amplitude, period, end - start) + [amplitude, period, change, overshoot] = @_calculateElasticValues(duration, amplitude, period, end - start) end = start + change return new Ease(this.engine, "elasticIn", infinite, start, end, @engine.current_frame, duration, invert_repeat, next, amplitude, period, overshoot) elasticInOut: (start, end, duration, next = null, infinite = false , invert_repeat = false, amplitude = null, period = null) -> - [amplitude, period, change, overshoot] = @_calculateElasticValues(amplitude, period, end - start, true) + [amplitude, period, change, overshoot] = @_calculateElasticValues(duration, amplitude, period, end - start, true) end = start + change return new Ease(this.engine, "elasticInOut", infinite, start, end, @engine.current_frame, duration, invert_repeat, next, amplitude, period, overshoot) expoOut: (start, end, duration, next = null, infinite = false , invert_repeat = false) -> @@ -207,7 +206,7 @@ class Ease return @change * (time * time * time + 1) + @start cubicInOut: (time) => - time = time / (duration / 2) + time = time / (@duration / 2) if time < 1 return change / 2 * time * time * time + @start else @@ -215,7 +214,7 @@ class Ease return change / 2 * (time * time * time + 2) + begin elasticOut: (time) => - time = time / duration + time = time / @duration amplitude = @params[0] period = @params[1] overshoot = @params[2] @@ -223,7 +222,7 @@ class Ease return (amplitude * Math.pow(2, -10 * time)) * Math.sin((time * @duration - overshoot) * (2 * Math.PI) / period) + @change + @start elasticIn: (time) => - time = time / duration + time = time / @duration amplitude = @params[0] period = @params[1] overshoot = @params[2] @@ -231,7 +230,7 @@ class Ease return -(amplitude * Math.pow(2, -10 * time)) * Math.sin((time * @duration - overshoot) * (2 * Math.PI) / period) + @start elasticInOut: (time) => - time = time / (duration / 2) - 1 + time = time / (@duration / 2) - 1 amplitude = @params[0] period = @params[1] overshoot = @params[2]