rstacruz / jquery.transit

Super-smooth CSS3 transformations and transitions for jQuery
http://ricostacruz.com/jquery.transit
7.3k stars 864 forks source link

API consistency with jQuery.animate() #169

Open ChrisKam opened 10 years ago

ChrisKam commented 10 years ago

Hello,

thank you for making this awesome plugin! I'm currently migrating some Fancybox stuff over to transit.js (as the default animation looks terrible in some browsers) and I have noticed something:

In jQuery, you can pre-define an object which you then pass into .animate like so:

var ani = { left: "+=50px", top: "+=100px", opacity: 1 }

and pass it in like this

$("element").animate(ani, { duration: 500, complete: functionname });

which I think makes the code really nice and clean. With transit.js, I would have to do this

$("element").transition({ left: ani.left, top: ani.top, opacity: ani.opacity, duration: 500, complete: functionname });

...which is redundant. $.extend obviously solves this issue but I really like how jQuery's animate() does that implicitly for you. For consistency's sake, I think it would be nice if jquery.transit would behave the same way.