-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
handle different length on mixpath #482
base: master
Are you sure you want to change the base?
handle different length on mixpath #482
Conversation
Should we return an error in such a scenario? And maybe recommend a library such as https://github.com/notoriousb1t/polymorph to prepare the paths? Let me know your thoughts on this. |
Hey @wcandillon, I will check this out. An error makes sense if having the same data length is a requirement. If not a I would expect the method to handle it. Another solution would be something likes this which results in a better animation: const p1a = {
...p2,
curves: p2.curves.map((_curve) => {
const c = JSON.parse(JSON.stringify(_curve));
c.c1.x = 0;
c.c2.x = 0;
c.to.x = 0;
c.c1.y = maxY;
c.c2.y = maxY;
c.to.y = maxY;
return c;
}),
};
return interpolatePath(value, [0, 1], [p1a, p2]); |
If having the same path length is a requirement we could at least note this in the documentation? Failing that, I would +1 this change! |
I forked the library and used the change already. Works for me, even though the animation looks better if the length is the same. Might handle this with a functions which reduces all arrays to the same length. |
I tried to install your fork but yarn/npm are not actually building the lib/modules, only installing the typescript src. |
@TonySchu I'm confused on what this change does exactly, can you walk me through me? Maybe provide me with two paths to interpolate as a test? you can add interpolate path test cases too. |
Mixpath was crashing when the length of the curve arrays were different.
This PR fixes it by using mixing the previous Path with the new one.