-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
draw transition creates visual artifact at the end of a path #4540
Comments
I was trying to recreate this for a much simpler use-case to determine if it was your export which did something wrong, and feel like perhaps it is. Is there a way to tweak your SVG? If I use a simple line: https://svelte.dev/repl/2ed53692a3054a84a5b5bf00a81034d1?version=3.19.2 It doesn't occur. |
Hi, I had the same issue this evening and found I got the artefact if I add a stroke-linecap: round (or square). I’ll link a repl with an example and how I worked around it in the morning. I think the issue may be in the getLength called in the draw method not accounting for the additional length of the caps. |
Thanks for the response @antony – I had forgotten about this issue! Looking at my old repl, it looks like |
Hi, here is a REPL https://svelte.dev/repl/a5584197164440fe9bc864dde19b0a99?version=3.24.1 showing both the standard draw method with the flicker, and one without, where I add the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I'm reopening this since there's an associated PR #6195 |
I was able to do a workaround where I took the svelte draw function and changed the line |
@MitchellDuhe That will work in your specific situation, a more general solution would be to change that line to the following lines: const has_end_caps = getComputedStyle(node).strokeLinecap !== 'butt';
const cap_size = has_end_caps ? parseInt(getComputedStyle(node).strokeWidth) : 0;
const len = node.getTotalLength() + cap_size; This will calculate the size of the caps and add it to the total length. |
This has been fixed in 3.42.5 - https://svelte.dev/repl/d034659637054c4588960fd037e40d1a?version=3.42.5 Thank you for the suggested fix @LBiddiscombe and thank you for the PR @wjtje - sorry it took so long to get this in! |
Describe the bug
In some cases, the
draw
transition creates in some cases a small flickering point at the end of a path. The SVG I based this off of was exported from Affinity Designer (an Illustrator competitor), introducing a number of matrix transforms into the export.To Reproduce
https://svelte.dev/repl/d034659637054c4588960fd037e40d1a?version=3.19.2
Information about your Svelte project:
Severity
I was experimenting w/ this approach for a work project. It's not a dealbreaker per se, but I might be disinclined to attempt this particular approach – exporting something from Illustrator and animating it with Svelte – in the future. This all said, I recognize this might simply be an artifact from the export that I haven't fully explored. The
draw
transition works fantastically when I use it in data visualization / in code-generated stuff.The text was updated successfully, but these errors were encountered: