News for hackers. Stuff that matters.
Re:Animating CSS Grid by phkahler on Friday January 18, 2019 @10:00AM (#18939707)
Why is this just now possible? Either CSS properties can be varied in this way or they can't right? Or is this a previously unimplemented part of the spec? And if so, why is animation (varying of properties) not a more general concept in CSS?
Re:Animating CSS Grid by memco on Friday January 18, 2019 @10:20AM (#18939856)
CSS animation is a fairly general concept but it is limited in some cases such as this by the fact that the renderer and spec have certain constraints that don’t play nice for the animation system. More specifically an animation might increment an integer by .01 until reaching the next one but the spec does not allow for fractional valise for that property so even though the value is changing the appearance is not. When the increment reaches a valid value the property will simply jump to the new value without showing any intermediate state. Grid I think is a particularly tricky spot for some of these properties because of such behavior.

To address some of the comments about use cases: we have a grid of items we want to filter based on a user’s search query. It is easy to animate the items disappearing but not easy to shift the remaining items into their new positions because the grid properties don’t let you animate that way. If I have an item in row 2 column 3 there’s not an easy way to transition it to row 1 column 1 at present. If you change the row and column values in this way it will jump from column to column row to row, not move from 125px,80px to 0px,0px along a sloped path.

Re:Animating CSS Grid by jonahx on Friday January 18, 2019 @10:26AM (#18939906)
A well tested (js) library that does such animated filtering well is:

https://isotope.metafizzy.co/

Re:Animating CSS Grid by phkahler on Friday January 18, 2019 @10:39AM (#18939987)
Thanks for the informative response.

>> To address some of the comments about use cases: we have a grid of items we want to filter based on a user’s search query.

Isn't that what XSLT is good for to some extent? I guess nobody seems to use it but it can do things like treat selected items differently. Using animation features to hide rows in a grid feels like the wrong solution to me.

Re:Animating CSS Grid by feluso on Friday January 18, 2019 @07:52AM (#18938938)
this is neat, I've been using css grid a lot lately and I feel like it solved a big part of my annoyances with CSS, and yeah sure I don't see a use case for this thing in particular but it looks fun, and I'm sure someone else will
Re:Animating CSS Grid by disease on Friday January 18, 2019 @10:13AM (#18939810)
The main reason I've been wanting this is to have panels that smoothly expand and collapse.
Re:Animating CSS Grid by dclowd9901 on Friday January 18, 2019 @11:24AM (#18940374)
You're building panels with a grid though?
Re:Animating CSS Grid by setr on Friday January 18, 2019 @07:22PM (#18944362)
My WebDev knowledge is quite poor but it seems natural to me that if you have slack-like sidebars, where they tend to be optional but non-temporary, the ideal solution would be 2 css-grids, and a way to switch between them. Even if it were temporary, like a shop using a sidebar for its menu , it still seems intuitively the preferred solution. Essentially just flipping between grid-states.

This is assuming you're actually dealing with a grid, and not some kind of floating pop-over panel eg a drop-down menu panel

How would you go about it? Maybe more importantly, how would you want to go about it?

Re:Animating CSS Grid by lexicality on Saturday January 19, 2019 @05:38AM (#18946345)
Honestly, for sidebars I'd use flexbox.

For anything where you only need to control one dimension, flexbox is way easier and cleaner. Plus you can animate it!

Re:Animating CSS Grid by chrismorgan on Friday January 18, 2019 @03:10AM (#18937770)
Is it possible to efficiently detect whether grid-template-columns and grid-template-rows are animatable in JavaScript, so that you can let the browser do it if they are, and manually tween if they’re not?
Re:Animating CSS Grid by spiderfarmer on Friday January 18, 2019 @03:13AM (#18937787)
As far as I know, there are only ugly ways like this one: https://stackoverflow.com/questions/4679288/detect-if-proper...
Re:Animating CSS Grid by antibland on Friday January 18, 2019 @07:09AM (#18938724)
Anything that can expand the creativity of people building web experiences is a good thing. Just looking at those demo vids gave me a bunch of UI ideas that stimulate my front-end dev brain.
Re:Animating CSS Grid by fareesh on Friday January 18, 2019 @08:07AM (#18939013)
Any roadmap for Chrome?
Re:Animating CSS Grid by matthewfelgate on Friday January 18, 2019 @04:10AM (#18938039)
I'm not sure if this is going to be a good idea long term. Do we want to element structural parts of a webpage.
Re:Animating CSS Grid by pictur on Friday January 18, 2019 @06:39AM (#18938606)
but why
Re:Animating CSS Grid by Sakes on Friday January 18, 2019 @10:38AM (#18939984)
If available in all major browsers, I'd use it for collapsable horizontal/vertical navigation panes/bars.
Re:Animating CSS Grid by yurishimo on Friday January 18, 2019 @07:15AM (#18938752)
Realistically? Probably art for a while until people can find a suitable UI that needs grid animations.

Or just nice transitions when changing responsive views.

Re:Animating CSS Grid by hema_n on Friday January 18, 2019 @07:56AM (#18938961)
A good one.
Re:Animating CSS Grid by anonu on Friday January 18, 2019 @06:29AM (#18938570)
The <blink> of 2019....
Re:Animating CSS Grid by Sakes on Friday January 18, 2019 @10:40AM (#18940000)
When done correctly and performantly, animations in web apps allow for a user experience that is closer to that of native apps.
Re:Animating CSS Grid by nullandvoid on Friday January 18, 2019 @10:04AM (#18939737)
Not sure if you mean this as a joke but css-grid is a pretty major productivity boost and won't be going anywhere any time soon I wouldn't think. The ability to animate will be a massively used feature I'm sure once more browsers support it
Re:Animating CSS Grid by anonu on Friday January 18, 2019 @11:24AM (#18940367)
I meant it partly as a joke, but the downvotes clearly indicate its not a lauging matter. css-grid is good, of course, but animating it has little application IMHO beyond nicer looking responsive design. I've been wrong in the past though - so I might wrong again.