Issues with fade animations

Issues with fade animations

Hi,
I've built a testpage to document this issues with fadeIn/Out: <a href="http://jquery-ui.googlecode.com/svn/branches/labs/fadequeue/index.html">http://jquery-ui.googlecode.com/svn/branches/labs/fadequeue/index.html</a>
As written on that page, the issues are:
<ul><li>Without using stop(), animations just queue up, thats inacceptable</li><li>With
just using stop(), styles end up in the middle, screwing up the next
fade, that is, stopping a fadeout half way through will cause the next
fade in to not fade to 1</li><li>Using stop(false, true) will
finish the animations, which worksaround the above problems, but the
result is ugly, as a stopped fadeout will skip to the end, then fade in
again from 0, instead of just fading in from the current opacity</li><li>The
crazy complicated stuff, using a mix of fadeIn/Out and fadeTo, apart
from being way too complicated, has the big drawback that the
fadeTo-animations take exactly as long as the others, while it usually
doesn't fade from 0 to 1, but only from, say, 0.7 to 1. Adding a
calculation to figure out how long the animation should be relative to
the current opacity would make this just more complicated.</li><li>fadeIn/Out can use opacity values defined in CSS stylesheets, while fadeTo requires the user to specify the opacity</li></ul>My goal for now is to create a plugin, with your help, that can be used instead of fadeIn/Out. It would not queue up animations, it would read opacity from stylesheets, just like fadeIn/Out do, and it would adjust the animation duration relative to the current opacity if a fade is stopped/reversed, so that if a fade in is stopped half-way through by a fadeout, the fadeout would only take half the specified duration, resulting in the same animation speed all the time.
Based on how the plugin ends up, I hope we can port back something to jQuery Core to make that available just as easily as fadeIn/Out.
Looking forward to your ideas.
Jörn


--