]> source.dussan.org Git - jquery.git/commitdiff
Revert "Effects: Remove additional parameters of easings"
authorOleg Gaidarenko <markelog@gmail.com>
Wed, 27 Apr 2016 20:21:56 +0000 (23:21 +0300)
committerOleg Gaidarenko <markelog@gmail.com>
Wed, 27 Apr 2016 20:21:56 +0000 (23:21 +0300)
This reverts commit b7a7dea95f84d6d8e5a8186d4fb09a762baf79bb.

Fixes #3064

src/effects/Tween.js
test/unit/tween.js

index 66f4df1069bbb3292a87033e3d5d805880068a79..43eb8fa0b19ba1a7ec1060ac7c56c8273dc55c1b 100644 (file)
@@ -29,12 +29,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 );
index f66aa37b6aad9c2b505e27ffc6ac473acc5245de..28fcfad257bc8bf8d19e4e9daed5ddcdc3299aec 100644 (file)
@@ -160,7 +160,8 @@ QUnit.test( "jQuery.Tween - Plain Object", function( assert ) {
 
        assert.equal( 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" );
 
        tween.run( 1 );
@@ -199,7 +200,10 @@ QUnit.test( "jQuery.Tween - Element", function( assert ) {
        eased = 100 - ( jQuery.easing.swing( 0.1 ) * 100 );
        assert.equal( 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(
                parseFloat( testElement.style.height ).toFixed( 2 ),
                eased.toFixed( 2 ), "Set value"