w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.44k stars 657 forks source link

[css-shapes-2] Interpolation between `shape()` and `path()` needs more detail #10740

Open smfr opened 1 month ago

smfr commented 1 month ago

CSS Basic Shapes 2 says that shape() and path() can interpolate if they have the same set of commands, specifically:

For this purpose, commands are "the same" if they use the same command keyword, and use the same keyword. For curve and smooth, they also must have the same number of control points.

But there's some ambiguity here, because shape() takes an initial "from", and it's not clear if that has to correspond to the first Move command in the path. Specifically, it's not clear if these should interpolate:

shape(from 0 0, move to 200px 200px, close)

and

path(M 100 100 z)

Likewise what if the first command in the path is not an absolute move?

shape(from 0 0, line to 200px 200px, close)

and

path(m 100 100 z)
smfr commented 1 month ago

cc @noamr @tabatkins

noamr commented 1 month ago

Good point, the easiest path forward here I think is that path() is always assumed to have from 0 0. It doesn't create special complexity and still allows interpolation with existing path() shapes.

A more complex alternative would be to squash all the first move by|to segments in both shape and path to a single from