-
Notifications
You must be signed in to change notification settings - Fork 669
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
[css-shapes-2] Consider allowing <position>
for the from
and some other points
#10644
Comments
Considering also #10649 , one option for clip-path: shape(from top left,
hline by 100px,
curve by 100px 50px / to right bottom,
curve by 50px 50px / 10% 20% / var(--x) var(--y),
curve by 50px 50px / 10% 20% / to bottom 50%,
smooth to bottom left / 0 0,
) It's probably nonsensical/confusing to give an absolute position as a control point and then continue to a relative one for the next control point or end point. Also added |
Hm, so is that back to a definite order for the points? aka control points first, then destination at the end? I'm not a fan of the implicit |
Right, I think having the control points first makes more sense given relative positions ( I'm also fine with keeping by/to for every point. Something like this? clip-path: shape(from top left,
hline by 100px,
curve by 100px 50px / to right bottom,
curve by 50px 50px / by 10% 20% / by var(--x) var(--y),
curve by 50px 50px / by 10% 20% / to bottom 50%,
smooth to bottom left / to 0 0,
) |
I disagree it's a mistake; it reads perfectly fine, to me, to say you curve "to" some position, "using" some control points, versus curving "using" some points "to" some destination. Both seem fine in English, and read reasonably in code I think. In your code, for example, I think it would look reasonable to have all the commands specify their endpoint immediately so the vertical reading gives a point-to-point path, and the stuff after the endpoints specifies command-specific info. We allow that in And, hm, if we have enforced keywords, that solves the "too many lengths in a row" by itself: clip-path: shape(from top left,
hline by 100px,
curve by 100px 50px to right bottom,
curve by 50px 50px by 10% 20% by var(--x) var(--y),
curve by 50px 50px by 10% 20% to bottom 50%,
smooth to bottom left / to 0 0,
) But if we continued to allow reordering by requiring clip-path: shape(from top left,
hline by 100px,
curve using by 100px 50px to right bottom,
curve using by 50px 50px using by 10% 20% by var(--x) var(--y),
curve using by 50px 50px using by 10% 20% to bottom 50%,
smooth to bottom left / to 0 0,
) Hm, kinda hate that, gotta say. |
Yea, I guess if we allow
So until now I don't see a better alternative than:
|
I think we need to collapse all the shape syntax issues together: |
I'm not a fan of "control points first". Mentally, you describe the point you want to get to, and then how to get there. I think SVG paths made a mistake with the "c1x c1y c2x c2y x y" ordering. |
Can't we use |
Yeah, that looks pretty good, imo. So That is, I do prefer that second one; I think having everything using the same coord system is usually what you want, so it should be the easiest thing to say. |
Yea I think that |
Yeah, the And having the |
Splitting from #5841.
The
shape()
function in CSS Shapes Level 2 is specified with thefrom
position being acoordinate-pair
, but this doesn't allow for keywords liketop left
.Similarly, you can't use
<position>
arguments as theto
point or control points on the various commands. Maybe we could allow if it's an absolute (to
) point. This would enable very natural shapes likeshape(from center top, line to right center, line to center bottom, line to left center, close)
.The text was updated successfully, but these errors were encountered: