X Tutup
Skip to content

Commit 82bb2ae

Browse files
committed
Revert "Effects: Remove additional parameters of easings"
This reverts commit b7a7dea.
1 parent ad358fd commit 82bb2ae

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

src/effects/Tween.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,17 @@ Tween.prototype = {
2727
Tween.propHooks._default.get( this );
2828
},
2929
run: function( percent ) {
30-
var hooks = Tween.propHooks[ this.prop ];
30+
var eased,
31+
hooks = Tween.propHooks[ this.prop ];
3132

32-
this.pos = this.options.duration ?
33-
jQuery.easing[ this.easing ]( percent ) :
34-
percent;
35-
this.now = ( this.end - this.start ) * this.pos + this.start;
33+
if ( this.options.duration ) {
34+
this.pos = eased = jQuery.easing[ this.easing ](
35+
percent, this.options.duration * percent, 0, 1, this.options.duration
36+
);
37+
} else {
38+
this.pos = eased = percent;
39+
}
40+
this.now = ( this.end - this.start ) * eased + this.start;
3641

3742
if ( this.options.step ) {
3843
this.options.step.call( this.elem, this.now, this );

test/unit/tween.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ QUnit.test( "jQuery.Tween - Plain Object", function( assert ) {
160160

161161
assert.equal( tween.now, 90, "Calculated tween" );
162162

163-
assert.ok( easingSpy.calledWith( 0.1 ), "...using jQuery.easing.linear" );
163+
assert.ok( easingSpy.calledWith( 0.1, 0.1 * testOptions.duration, 0, 1, testOptions.duration ),
164+
"...using jQuery.easing.linear with back-compat arguments" );
164165
assert.equal( testObject.test, 90, "Set value" );
165166

166167
tween.run( 1 );
@@ -199,7 +200,10 @@ QUnit.test( "jQuery.Tween - Element", function( assert ) {
199200
eased = 100 - ( jQuery.easing.swing( 0.1 ) * 100 );
200201
assert.equal( tween.now, eased, "Calculated tween" );
201202

202-
assert.ok( easingSpy.calledWith( 0.1 ), "...using jQuery.easing.linear" );
203+
assert.ok(
204+
easingSpy.calledWith( 0.1, 0.1 * testOptions.duration, 0, 1, testOptions.duration ),
205+
"...using jQuery.easing.linear with back-compat arguments"
206+
);
203207
assert.equal(
204208
parseFloat( testElement.style.height ).toFixed( 2 ),
205209
eased.toFixed( 2 ), "Set value"

0 commit comments

Comments
 (0)
X Tutup