Skip to content
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

Invalid SVG paths #2

Open
karip opened this issue Nov 14, 2017 · 1 comment
Open

Invalid SVG paths #2

karip opened this issue Nov 14, 2017 · 1 comment

Comments

@karip
Copy link

karip commented Nov 14, 2017

bodymovin-to-avd seems to be creating bad SVG path data.

pathData.js has code to add a ‘c’ command without coordinates to the end:

if(data.c) {
pt = matrix.transformPoint(data.o[i][0] + data.v[i][0], data.o[i][1] + data.v[i][1]);
pathValue += ' C' + roundValue(pt[0]) + ',' + roundValue(pt[1]);
pt = matrix.transformPoint(data.i[0][0] + data.v[0][0], data.i[0][1] + data.v[0][1]);
pathValue += ' ' + roundValue(pt[0]) + ',' + roundValue(pt[1]);
pt = matrix.transformPoint(data.v[0][0], data.v[0][1]);
pathValue += ' ' + roundValue(pt[0]) + ',' + roundValue(pt[1]);
pathValue += 'c';
}

If the intention is to close the path, then the real SVG command is ‘Z’.

Interestingly, Android accepts the currently generated invalid paths. However, if the paths are viewed in a web browser, then only the first subpath is visible if the path is made of multiple subpaths. Here’s an example path with multiple subpaths: “ M10 20 C10,5 20,5 30,30c M20 20 C10,5 20,5, 30,0c ”. The invalid commands are highlighted.

@bodymovin
Copy link
Owner

Yes, I've seen this bug. I'll fix it in the next deploy.
Thanks for reporting it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants