-
Notifications
You must be signed in to change notification settings - Fork 133
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
Can we fix arc interpolation? #941
Comments
This seems pretty obvious to me. I can see no benefit to keeping the old behavior, and seriously doubt any existing content is using the old behavior. In any case, we should favor the utility for authors over mindless adherence to "backwards compatibility". There's historically been a lot of reluctance among browser vendors to change or improve their SVG implementations, but if that inertia can be overcome, I think this would be an excellent change (modulo the details to be worked out, of course). This is one of those cases where a small amount of work by standards and implementers could save authors and tools a disproportionate amount of work and frustration. |
I’m (cautiously) optimistic because this doesn’t require any actual syntax changes, and affects CSS too ( |
|
The SVG2 draft has still no version numbering - therefore there must be no backwards incompatible addition or changes. My suggestion: Add version numbering and new commands for another type of arc for alternative usage/applications. |
(Originally posted in w3c/csswg-drafts#10195)
Currently paths are naively interpolated by matching up segments and points and interpolating them as numbers.
This is defined in the Paths section:
So basically, control points are animated separately, and flags (of which the arc command has two!) just flip halfway.
This works decently for most path types, but as you can see in this demo this produces terrible, terrible results for arcs.
Here is another example: a dynamic pie chart using CSS transitions on
d
to animate across state changes (using a3s
duration to clearly show what’s happening):arc-wrong.mp4
Fixing this in authorland is incredibly tricky and computationally expensive. Worse yet, it’s one of those things that seem deceptively simple from the outside, but incredibly hard once you’re actually working on them.
This can be easily fixed at the source, without any author-facing changes, by simply adopting smarter interpolation rules for arc commands, which interpolate the actual features of the arc (offset, angle, radii, etc.) instead of the coordinate points and flags.
As @svgeesus pointed out in w3c/csswg-drafts#10195 (comment), the interconversion between actual arc features and SVG path syntax is well defined.
There’s the question of whether changing the default behavior here would be web compatible, but as @tabatkins points out in w3c/csswg-drafts#10195 (comment) there is practically no case where the current behavior is desirable (except demos like mine showing how bad it is 😅 ).
So I guess the questions to answer are:
If we have consensus on these, I'd be happy to do some work towards fixing this.
The text was updated successfully, but these errors were encountered: