Comments (6)
Thanks for the demonstration case! I think what's going on here is that maxSegmentLength
is 10 by default and it's in pixel space, so these paths are so short that not enough points are getting added (this only affects path string inputs, not array inputs).
For an immediate fix you can specify a maxSegmentLength
that's less than 1/3 the total length:
https://runkit.com/590ff00e90d6f10011380a19/593ebcea407b44001216b817
In the short term I'll fix so that it always polygonizes a path string into a minimum of three points. Longer term I'm planning to turn maxSegmentLength
into a relative value anyway (e.g. 0.1
means no segment can be longer than 10% of the whole perimeter), which should help.
from flubber.
Thanks so much for Flubber! I'm really excited to use it. I'm running into a similar problem that I'm not able to fix with the maxSegmentLength
solution you have here. I've added a sample path to runkit here: https://runkit.com/ejfox/594bd75bc5101e00118c0f5a
I've uploaded a snapshot of my project in case that helps as well: http://stenographer-access-43136.netlify.com/
Appreciate any help you can offer!
from flubber.
Will look into it - I notice that your runkit sample is using an old version (0.2.2), and your app bundle might be also. This was patched in 0.2.6, so try installing the latest?
from flubber.
Strangely, I'm not able to reproduce this even with 0.2.2 in Node or in browser. Let me know if you're still getting it with a 0.2.6+ version?
from flubber.
Thanks Noah,
I've been playing around with things for the last few days after updating to 0.3.0 and going through the demos to figure out my bug a little better. I've made some progress but still encountering some paths that return errors.
I've made a new runkit with a problematic path using 0.3.0 https://runkit.com/ejfox/flubber-error
from flubber.
So your example path string has two individual rings. By default, flubber will only use the first ring, which in this case is:
M673.504130256738,582.2362322253204
L673.4952926184682,582.137462231841
L673.504130256738,582.2362322253204Z
The first and third points are identical, so it's really only a two-point line segment rather than a polygon with any interior area, which is why it fails the test.
I'm still undecided on how to handle cases like this, but in the meantime if you want to avoid this error you could take the second ring from the path string instead, which seems like the important shape anyway:
var interpolate = f.toCircle(f.splitPathString(a)[1], 0, 0, 8);
from flubber.
Related Issues (20)
- Typescript typings
- Jest test fails: r.getTotalLength is not a function HOT 2
- Can we use flubber to animate from svg shape to path HOT 1
- Interpolate fills the shape HOT 2
- Using in Gatsby with IE11 HOT 1
- Animation typical doesn't work over time
- Error: 'svgPathProperties' is not exported HOT 1
- Broken in latest Chromium HOT 4
- output precision for path strings need not use 16 digits
- Reanimatedv2 HOT 1
- Porting to other languages HOT 2
- async API / non-blocking interpolation (using webworkers)
- Factor out `Number.isFinite` HOT 1
- Expose an API that outputs the compatible to/from path strings HOT 1
- Multiple instances of flubber.js HOT 1
- Improving performance: aka To-Do for Performance HOT 1
- Flubber performs differently when loaded via webpack/babel. HOT 4
- Add flubber.align()?
- flubber with greensock HOT 3
- Support for open/unclosed polygons (polylines) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flubber.