Bug Tracker

Opened 9 years ago

Last modified 7 years ago

#8685 closed enhancement

Animations should keep track of animation state in order to properly address stacked animations — at Version 17

Reported by: ajpiano Owned by: gnarf
Priority: blocker Milestone: 1.8.3
Component: effects Version: 1.5.1
Keywords: 1.7-discuss Cc:
Blocked by: Blocking:

Description (last modified by timmywil)

None of the various combinations of utilising .stop() gracefully handle many quick animation triggers in a desirable way:

http://jsfiddle.net/ajpiano/gqZL5/10/ http://jsfiddle.net/rpflorence/gqZL5/

In MooTools, this is handled in a much more intuitive way, because it tracks the animation state internally.

http://jsfiddle.net/rpflorence/gqZL5/1/

We should support this common usecase more gracefully

Change History (17)

comment:1 Changed 9 years ago by ajpiano

Component: unfiledeffects
Milestone: 1.next1.7
Owner: set to john
Priority: undecidedhigh
Status: newassigned

comment:2 Changed 9 years ago by ajpiano

See also #2408

Last edited 9 years ago by ajpiano (previous) (diff)

comment:3 Changed 9 years ago by timmywil

#8830 is a duplicate of this ticket.

comment:4 Changed 9 years ago by john

#2408 is a duplicate of this ticket.

comment:5 Changed 9 years ago by john

Milestone: 1.71.next
Owner: john deleted

Let's get this on the roadmap for 1.7.

comment:6 Changed 9 years ago by john

Keywords: 1.7-discuss added

Nominating ticket for 1.7 discussion.

comment:7 Changed 9 years ago by jaubourg

Description: modified (diff)

+1,

comment:8 Changed 9 years ago by timmywil

+1, +1 +1 +1 +1 +1

comment:9 Changed 9 years ago by dmethvin

Description: modified (diff)

+1, Is someone volunteering?

comment:10 Changed 9 years ago by timmywil

Owner: set to timmywil

comment:12 Changed 9 years ago by timmywil

Milestone: 1.next1.7

comment:13 Changed 9 years ago by john

Description: modified (diff)

+1, Sounds cool - let's go for it!

comment:14 Changed 9 years ago by scottgonzalez

+1, this is really interesting, but I assume it only works when using the same animation for both directions?

comment:15 Changed 9 years ago by rpflorence

MooTools has a "link" option when animations are stacked. There's "ignore", "cancel", and "chain".

Ignore - ignores any calls while animating Cancel - Cancels the current animation, starts the next one from the current state (what you're seeing in the original fiddle I created for ajpiano) Chain - Stack the next effect. The default jQuery behavior (rarely what you want).

This option is obviously really helpful. I've been working on porting the MooTools Fx constructor to power the jQuery effects mostly for this option (and I find them a little smoother in some browsers).

comment:16 Changed 9 years ago by rpflorence

@timmywil - I'm not entirely familiar with the underlying jQuery.fx, but wouldn't it be better to do the state tracking there so it just works™ with all animations? (rather than changing a lot of code in the shortcuts like show and slideToggle)

Regardless, VERY happy to see this progress on your 1.7 branch. I'm using jQuery for most of my work these days and battling this has ladened my transition to jQuery with frustration :)

Last edited 9 years ago by rpflorence (previous) (diff)

comment:17 Changed 9 years ago by timmywil

Description: modified (diff)

@rpflorence: jQuery fx has a different structure than Mootools, a structure I don't think we want to change. The options mentioned can be replicated in different ways in jQuery. Ignore might be similar to setting queue to false, chain as you said is the behavior of the jQuery queue (which has its own advantages I think), and cancel...well that wasn't really an option before unless you created your own animation that kept track of state. Finally, I think you're confused about what I've written. The code I've added and updated will work for all animations. The show function you see updated is not jQuery.fn.show, it's the show on the jQuery.fx prototype. Any property set to "show" or "toggle" will use this function and that is what we're talking about. Animations set to actual values are unaffected because we don't have to do any calculations for the user. Like I said before, you could already do before what is done in MooTools with a custom jQuery animation that sets values and keeps track of its own state. This will add that state tracking so that actual values do not need to be passed. I think what you're asking for in your last comment is really what I've already done. Anyway, I agree. This is something I've wanted jQuery to do since I first started using it as well.

Note: See TracTickets for help on using tickets.