Bug Tracker

Opened 8 years ago

Closed 8 years ago

#9067 closed bug (fixed)

.animate() array easing issue.

Reported by: sciolist.se@… Owned by: sciolist.se@…
Priority: high Milestone: 1.next
Component: effects Version: 1.6
Keywords: Cc:
Blocked by: Blocking:


When attempting to perform an animation using:

  $("#test").animate({ opacity: [0, "swing"] });

no transition takes place, however, using:

  $("#test").animate({ opacity: 0, easing: { opacity: "swing" } });

works as expected.. You can fix the functionality by adding:

if(jQuery.isArray(val)) {
	(opt.specialEasing = opt.specialEasing || {})[name] = val[1];
	prop[name] = val[0];

at line 8030 of the full jquery source.. not at home, so can't supply a patch, sorry.

Change History (7)

comment:1 Changed 8 years ago by dmethvin

Owner: set to sciolist.se@…
Status: newpending

Can you provide a test case? Was this a regression from a previous version?

comment:2 Changed 8 years ago by Rick Waldron

Component: unfiledeffects

dmethvin, according to the docs, this wasn't supported. I wonder if the op meant to file as an enhancement?

comment:3 Changed 8 years ago by sciolist.se@…

Status: pendingnew

I'm pretty certain it was supported, if you look at http://api.jquery.com/animate/#per-property-easing, those arrays of ["toggle", "swing"] are no longer functioning.

The broken functionality is caused because on line 192 of animate (https://github.com/jquery/jquery/blob/master/src/effects.js#L194), there's a check to see if the value from the options set is an array, and it then uses the second item as an easing method.. unfortunately, it never resets the value to the first item, leading to jQuery attempting to animate say, opacity, to an array value.

The code was broken in change 7666c3ef, you can see the old code before that, (https://github.com/jquery/jquery/blob/eccf15be6cfee8b567785ba29cc8841b1b0c2ef1/src/effects.js#L186) which appropriately sets the value. Without having further inspected the problem, it may be possible to fix just by reverting that one line.

I'll write together a test case to demonstrate the issue.

comment:4 Changed 8 years ago by threecreepio


demonstrates the issue, switch between 1.5 and 1.6 to see the difference.

comment:5 Changed 8 years ago by timmywil

Priority: undecidedhigh
Status: newopen

yea, this is supported

comment:6 Changed 8 years ago by threecreepio

there's a pull request for the issue: https://github.com/jquery/jquery/pull/369

comment:7 Changed 8 years ago by Daniel Pihlstrom

Resolution: fixed
Status: openclosed

Fix per-property easing. Fixes #9067

Changeset: 3d1c27d52ec667cea5735366a41f65344ab17a5e

Note: See TracTickets for help on using tickets.