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

Bug: PropertyNode.createList leads to errors if there are two points with same value #209

Open
CosmoMyzrailGorynych opened this issue Dec 26, 2023 · 2 comments

Comments

@CosmoMyzrailGorynych
Copy link

In this file and this line,
https://github.com/pixijs/particle-emitter/blob/master/src/PropertyNode.ts#L104
The PropertyNode bails out forming a complete list if it finds that the only two values in a list have same values. Still, all the behaviors try to interpolate over such lists, leading to errors, and crashing the whole pixi.js app:

изображение
изображение

Why am I having timeline points when I have same values instead of having static behaviors? Because I am making a general-use app where users are free to write everything they desire, and handling that behaviors array in emitters' config objects is enough of an attraction for me in definitely typed projects to handle already.

@andrewstart
Copy link
Collaborator

I can defend against this by flagging such lists as stepped, but the expectation here was that any editor would check the user's data and use the simpler static behavior for the improved performance since the interpolation of a list is not needed.

@CosmoMyzrailGorynych
Copy link
Author

The expectation here was that any editor would check the user's data and use the simpler static behavior for the improved performance since the interpolation of a list is not needed.

This complicates using the particle-emitter library a lot 🤷 In my editor I need interactivity and live preview, including when users make changes — can't do that with switching behavior types. Even so, the editor and its assets need to be definitely typed, which is doable in the end, but it is way too much of a hassle with alternating types and tuples, and you still have to wire up that all in UI. TL;DR upgrading to particle-emitter v5 was a nightmare and I don't want to look into rewriting it again.

Aside from my struggles, I believe a library should not alter the input, at least not without a library user's consent — and there were no warnings in docs or console about using a flat line in property lists. This unauthorized automagic led to long hours of finding out why my emitter tandem editor randomly breaks for my users. And if a library does alter input, failing with errors after this expected behavior is definitely a bug.

A side note, I looked through the sources and did not understand why the simplification of two-point lists was needed. If you have time, could you explain that?

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