4 ms·
That first quote (using JS when CSS would be faster and simpler) does remind me of being a beginner and always arriving at jQuery's animate() for all my needs.
by hombre_fatal 6y ago
That first quote (using JS when CSS would be faster and simpler) does remind me of being a beginner and always arriving at jQuery's animate() for all my needs.
That said, animation is hard, and React doesn't insulate you from that, so it takes some thought. In fact, being a layer of abstraction, it requires even more understanding of animation. Fading a component in is easy with regular CSS transitions. But fading a component out generically means that you have to keep the component mounted for the transition.
Perhaps anyone who has used react-bootstrap's Transition system (animate={true} on modals and tooltips) has run into those quirks where you start seeing a pattern of animate={false} fixing all sorts of random bugs.
With React, if you're grabby with 3rd-party libraries, you can end up with a russian doll of HoCs, each one from a different library, that are so generic that they kill performance and it's not even obvious why without being a profiler expert. Whereas without React, you wouldn't have found those solutions at all, so you roll your own cross-cutting solution.
That isn't necessarily a problem with React, but something that you have to resist with frameworks in general. It reminds me of Ruby on Rails, googling "rails avatars" and ending up with two libraries like carrierwave + "has_avatar" when you could have just built your own simple solution. It's a form of technical debt. After all, it's hard to justify the effort of deabstraction when you're assigned to 100 other issues.
- Jestar342 6y agoRE: jQuery.animate() - that was around before CSS animations were. Animations were not in the CSS spec until v3 which only saw widespread support this side of 2010. Before then you could only do animations with Javascript, and frankly jQuery's `animate()` was a god-send.
- dsego 6y agoOn top of that, js animations are still better for controlling timing and events or for a more realistic natural motion (springs instead of timed easing).
- heavenlyblue 6y agoI would say that what JS animations are even better at is justifying inflated budgets of the projects made for people who are not very familiar with tech. Is there ever a real reason for animations that doesn't make the interface feel sluggish and unresponsive? In the other hand if you actually set the animation delay to something incredibly low, all of your animation needs could be easily solved by animating the transparency of the appearing elements.
- mattmanser 6y agoAnimations are effective, and I say that as someone who really hate slow ones. If you start paying more attention to the apps you use, especially ones made by bigger companies, and you'll notice how effective some of them can be.
- heavenlyblue 6y agoIs the latest version of Google Calendar web interface a good example? I don't think it is. And it's from a company which can afford a lot of development resources for that.
- recursive 6y agoYou can use it to make your UI more obvious. If you hit "Delete", the item might shrink and slide (within say 200ms) into the "trash can". This way the user knows they can undelete from the trash can.