From 268af5a092ba803dda6d95cd5655883c59a1cc70 Mon Sep 17 00:00:00 2001 From: Oleg Gaidarenko Date: Tue, 22 Dec 2015 14:32:03 +0300 Subject: [PATCH] Revert "Effects: Remove additional parameters of easings" This reverts commit 41a04e59df5beac4ca61b3b5e3a6b078b6aee1ac. --- src/effects/Tween.js | 15 ++++++++++----- test/unit/tween.js | 6 ++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/effects/Tween.js b/src/effects/Tween.js index 4e85e3c51..33edf10f3 100644 --- a/src/effects/Tween.js +++ b/src/effects/Tween.js @@ -27,12 +27,17 @@ Tween.prototype = { Tween.propHooks._default.get( this ); }, run: function( percent ) { - var hooks = Tween.propHooks[ this.prop ]; + var eased, + hooks = Tween.propHooks[ this.prop ]; - this.pos = this.options.duration ? - jQuery.easing[ this.easing ]( percent ) : - percent; - this.now = ( this.end - this.start ) * this.pos + this.start; + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; if ( this.options.step ) { this.options.step.call( this.elem, this.now, this ); diff --git a/test/unit/tween.js b/test/unit/tween.js index ddd2e8d43..42ab03789 100644 --- a/test/unit/tween.js +++ b/test/unit/tween.js @@ -217,7 +217,8 @@ QUnit.test( "jQuery.Tween - Plain Object", function( assert ) { tween.now, 90, "Calculated tween" ); - assert.ok( easingSpy.calledWith( 0.1 ), "...using jQuery.easing.linear" ); + assert.ok( easingSpy.calledWith( 0.1, 0.1 * testOptions.duration, 0, 1, testOptions.duration ), + "...using jQuery.easing.linear with back-compat arguments" ); assert.equal( testObject.test, 90, "Set value" ); @@ -280,7 +281,8 @@ QUnit.test( "jQuery.Tween - Element", function( assert ) { tween.now, eased, "Calculated tween" ); - assert.ok( easingSpy.calledWith( 0.1 ), "...using jQuery.easing.linear" ); + assert.ok( easingSpy.calledWith( 0.1, 0.1 * testOptions.duration, 0, 1, testOptions.duration ), + "...using jQuery.easing.linear with back-compat arguments" ); assert.equal( Math.floor( parseFloat( testElement.style.height ) ), Math.floor( eased ), "Set value" ); -- 2.39.5