Re: [csswg-drafts] [css-shapes-2] `curve to` keyword `using` seems a bit off (#10649)

> Here's a stab at the grammar:
> 
> ```
> shape() = shape( <'fill-rule'>? from <coordinate-pair>, <shape-command>#)
> 
> <shape-command> = <move-command> | <line-command> | <hv-line-command> |
>                   <curve-command> | <smooth-command> | <arc-command> | close
> 
> <coordinate-pair> = <length-percentage>{2}
> <relative-control-point> = [<coordinate-pair> [from start | from end]?]
> <to-control-point> = [<position> | <relative-control-point>]
> <by-to> = by | to
> 
> <move-command> = move [to <position>] | [by <coordinate-pair>]
> <line-command> = line [to <position>] | [by <coordinate-pair>]
> <hv-line-command> = [hline | vline] <by-to> <length-percentage>
> <curve-command> = curve [to <position> with <to-control-point> [/ <to-control-point>]?]
>                       | [by <coordinate-pair> with <relative-control-point> [/ <relative-control-point>]?]
> <smooth-command> = smooth [to <position> [with <to-control-point>]?]
>                         | [by <coordinate-pair> [with <relative-control-point>]?]
> <arc-command> = arc [to <position>] | [by <coordinate-pair>] of <length-percentage>{1,2} [<arc-sweep>? || <arc-size>? || [rotate <angle>]?]
> ```
> 
> Notes:
> 
> * `<position>` is only allowed in the "to" argument, and for "to" control points
> * `from start` and `from end` are allowed in both "to" and "by" commands
> * the destination point comes before the control points, using the `with` keyword for control points
> * two control points are separated with a slash
> * In the `arc` command, the radius comes after the destination point (seems better than arbitrary order, but I could be persuaded).
> * There's no way to use positions in `hline` or `vline` but maybe we should allow `vline to bottom` ? Not sure how to write that grammar.

Mostly looks good! I'd also add `from origin` which makes control points in a relative curve absolute.


-- 
GitHub Notification of comment by noamr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10649#issuecomment-2401822167 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 9 October 2024 09:33:33 UTC