4 ms·
I've been wanting something like this, thanks! It can be tedious to set up animations by hand in the CSS, and since animations have more to do with behavior tha
by lukifer 16y ago
I've been wanting something like this, thanks! It can be tedious to set up animations by hand in the CSS, and since animations have more to do with behavior than styling, it makes the code a lot cleaner.
A nice-to-have would be detecting the presence of common JS libraries, and falling back to jQuery/etc DOM-based animation on browsers that do not support CSS transitions.
- ionfish 16y agoThanks, that's an interesting suggestion. I'll have to think a little about how it would work in practice—object detection is simple, but I'd need to make sure I could map the API well enough in each case for it to be worthwhile. If I did do that, it would probably be as an optional library (specified at build time), providing a fallback in the same way I intend to provide a fallback for browsers which don't provide an implementation of CSSMatrix. The other possibility would be to embed a minimal animation library like Émile [1], and just use that directly. The other way of doing this would be to pull Firmin into more general DOM libraries as an alternative animation backend, and toggle between them based on runtime feature detection (for an example of how to do this, see [2]). A special case of that is doing it at the application level, in cases where the potential performance gains are vital; I mention an instance where I've actually done this in the article. [1] https://github.com/madrobby/emile https://github.com/madrobby/emile [2] https://github.com/othermedia/edgecase/blob/master/source/edge-gallery.js#L68-89 https://github.com/othermedia/edgecase/blob/master/source/ed...