-
Notifications
You must be signed in to change notification settings - Fork 20.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate Velocity.js to replace jQuery animate #2053
Comments
Hey, all! Author of Velocity. Even if it doesn't come to fruition, very excited to explore the potential and to improve animation in both jQuery and Velocity. Thoughts: Pro's:
Con's:
|
Personally I love this idea. With GSAP and Velocity around, from a performance perspective, there's no reason to use the current jQuery animation engine (aside from the cost of adding another dependency to an app). |
I will re-iterate points i made at the meeting:
First point is widely considered as a bad way to write your code. Second, was recognized as bad practise long time ago, we (and basically everyone else) have always advocated against such logic. Third point, is why i believe jquery performed slower, now this is shouldn't be the case. Would like to see performance test on that. Forth point failures, are API incapability's, some of them are internal, while some of them really aren't. So i have mixed feelings about statement:
Although, i wouldn't consider it as replacement, but it would be interesting to see if we could re-use some of the tricks of this library. If, of course, there something interesting, aside from use of I see velocity popularity as a result of qualified marketing efforts then anything else. It would be nice to prove me wrong. |
/cc @gnarf |
It does. I don't publicize them but I will later this week.
This is a micro-concern that can be quickly refactored. Its sparing use of UA detection is only limited to a small subset of behavior. I could probably rip it out entirely. This concern is better suited for a subsequent discussion entailing what Velocity would have to refactor in order to be a replacement.
There are articles that detail the Velocity performance optimizations that go far beyond rAF. I'd refer to the Velocity documentation. Regardless, the primary benefit of Velocity is one of workflow enhancement: reversal, proper scrolling, looping, SVG animation, transform animation, UI mocking, and more. That's why people who switch to it also continue using it. Performance is just the allure for checking it out.
Yep. One thing I spoke to David about was my interest in passing all those tests. But, something to consider: A jQuery 4.0 SEMVER release (for example) wouldn't necessarily have to pass every little-used animation edge case. More on this TBD, but I believe some minor breaking changes should occur for the better. Again, TBD.
Most of the articles and tutorials on Velocity focus on its workflow benefits -- not its performance. The workflow benefits are inarguably a game changer for anyone doing UI motion design. If it were a fad, its popularity wouldn't be enduring. (P.S. Some cool Velocity stuff: http://codepen.io/search?q=velocity&limit=all&depth=everything&show_forks=false.) |
I think its better to do the perf test, numbers are best arguments i think
Not arguing against that, but i wonder if it is in jQuery scope, since one of the jQuery goals is to try to be as small as possible. While if you want something more extensive, then that task might be better suited for the specific animation framework. I'll be quieter now so i wouldn't clutter/derail the discussion, since it would be really interesting to hear thoughts of the "/cc" people :-). |
jQuery Animate wasn't ever about "performance" imo... It was about dealing with some of the REALLY common animation use cases in the web dev world. Those use cases are changing, and velocity has more of them covered. I'm more interested in knowing what parts of the jQuery animation unit tests would need "compat" to work with velocity at the core, if any of them "can't work" with velocity at the core, and how much work @julianshapiro thinks it is, or his own personal cost/benefit. I don't think performance should even be a topic in this thread. It's micro-perf at best. Performance is something we can work on together as well, a lot of us have experience here. I'm interested in hearing from @arschmitz as well. |
I have been following Velocity, and the change of jQuery @gnarf as well as the rest of the UI and Mobile teams have talked about the pro's and cons around this and our current approach was going to be to start with jQuery Core Depending on the outcome of that our next step was going to be to either look into using velocity directly, or what it was doing, and try to improve These tests were purely visual ( no frame rates or anything ) and at the time velocity did not give a noticeable benefit though the pages were admittedly simplistic, and more complex pages, is where velocity would make more of a difference, from my understanding.
👍 I think we can work together so that either way perf will not be a concern I don't really have an opinion on velocity vs |
Also @julianshapiro feel free to reach out to me in IRC (@gnarf) or google hangouts gnarf37 at gmail if you want to talk about any of the unit tests / why we do them in jQuery. |
Thanks for the edit of your "reserved" comment @julianshapiro (everyone else should scroll up and re-read comment number 2) --
Do you have an idea what those edge cases may be?
Do you have an idea what the difference in weight between effects.js and velocity.js is currently? We do like small compact things (and we have a few of those nuts that could probably help)
I'm totally on board with the plan as is, but I'm just a little worried about breaking >too much< backwards compat, or significantly increasing the file size of "basic jquery" Have you given any thoughts to making "velocity-core" which we could include, and then adding the bigger (byte size) features (like color) in plugins? Also, have you looked at the jquery-color api/way it does it's thing? I really like the idea of taking "core" velocity to replace effects (if it can cover most of the units) for the "minimum needed" and then have easy to install plugins for everything else? |
Thank you for all your effort! There are obviously still details to work out concerning the implementation, but I think it would be safe to say that we can move forward, with just a couple addenda.
Some things that we'll need to take care of before inclusion:
|
QFT 😍 |
I was excited about this idea, mostly as the anti-rAF situation was getting bad (fixed now, yay!), but I feel a little conflicted now. First, @markelog's original concerns seem pretty valid. Tests should be published from the get go, and hooked into CI for sure. My heart is broken over the UA sniffing; definitely seems addressable, but just kinda surprised..
True. Velocity, as a library, targets a sort of authoring & workflow feature set that's beyond what the basic animate() API shoots for. But inside of jQuery, we're really only interested in the animation engine and not the "reversal, proper scrolling, looping, SVG animation, transform animation, UI mocking" sugar that's available. In that respect, this combo is a little funny: velocity's value proposition is around these workflow aspects but jQuery only needs a very basic animation/tweening core. Even snabbt.js which is 1/3 the size of Velocity has more functionality than jQuery needs. On performance, it'd be easy to show velocity whopping legacy
Tangentially related. I can see why julian questions the necessity of backward compatibility. In particular, the |
I'll hook Velocity into jQuery's tests and find out shortly :)
If you take into consideration that Velocity's internal CSS getter/setter engine would replace jQuery's in the process (which is what I initially spoke to David about), then it would be a net negative -- we'd be saving bytes. Without taking that into consideration, probably around ~4kb ungzipped extra. Have to check. But if Velocity goes inside jQuery, I'd be removing some features to keep it more "necessity" focused, in which case there would likely not be a size boost even in this hypothetical situation.
I have my reasons (hint: I wanted to discourage PR's at the time -- was happy to code in feature requests myself), but I've always had great tests from day one. Will publish them this weekend as mentioned.
I feel like I let my dad down.
That's a core assumption that I haven't heard echoed elsewhere. In fact, as far as I understand the motivation on jQuery's behalf, it's to rethink that statement as a whole. In short, we must be asking, Should jQuery only be very basic in its animation functionality? The answer, from my motivation/perspective, is "no": On a base level, not having SVG, color, and transform animation support in 2015 is arguably unacceptable. If jQuery continues to lack these features going forward, its animation functionality will continue to need wide-spread supplementation. On an enriched workflow level, I agree: The more advanced workflow features that Velocity offers do not (and probably should not) be part of jQuery. Here's the good news: They're not even part of Velocity to begin with -- they're relegated to Velocity's UI pack (VelocityJS.org/#uiPack) :) |
Going to put my 2p worth in as a long time jQuery and VelocityJS user (and in the business of web development). When I discovered Velocity (not long after it came out) I was impressed by it's low overhead and smooth animations compared to jQuery - to the extent that I now add it to any projects that need animations beyond the most basic. I use the best tool for the job, so am quite happy to custom build jQuery without animation support, or use css animations, depending on what I'm trying to achieve - but am still coming back to Velocity (something that is repeated in the large number of sites now using it). As of yet I've never run Velocity without jQuery, but that's more to do with the scale of the sites I need to develop for. In other words - while Bringing the core of Velocity in (possibly with a couple of small changes to calls to fit in with how jQuery does things) would only be a positive thing. It's already there as an extra library, but that does mean extra bandwidth - part of the entire balancing act job. I'd almost suggest a jQuery slimline base Velocity (ie, a->b animations and basic control), then add the rest of the things that make Velocity special into jQueryUI (colours, sequences etc, not unlike some things already in there) - both already have the ability to build custom version for what is needed, so while that would make for a major code shuffle, it's already a minor reshuffle to begin with. As far as breaking things with changing the API goes, to the best of my knowledge any API changes would be additions rather than replacements, with most of the big differences more related to wrappers that can be updated. The tl;dr version is basically this: jQuery could write it's own improved animation code, then both projects could continue duplicating efforts to fix issues and improvements in browsers, or both projects could come together for extra initial work, but end up with something better ;-) |
This issue has been sitting for a bit. @julianshapiro Did you happen to hook Velocity up to jQuery tests? |
Thank you to everyone who gave input on this, but it doesn't look like it's realistically going to happen. We're still happy to review code on the matter and the issue can be reopened if necessary. |
This issue is to explore the possibility of integrating velocity.js into jQuery. This is a huge change, so, naturally, we need everybody involved in the discussion.
/cc @SlexAxton @paulirish
The text was updated successfully, but these errors were encountered: