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

feat: adding custom event handler #104

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sentisso
Copy link
Contributor

@sentisso sentisso commented Mar 7, 2023

I had a special situation in my project, where I'm using fireworks-js, where I needed to detect whenever a firework explodes.
One possible way to achieve this is by pre-calculating when a certain firework will explode, which is kinda difficult and not reliable, because it highly depends on the number of animation frames.

The way I handled it in the update function is kinda unorthodox, since it is being run inside an animation frame, but it's the easiest way to achieve this.
I also added an example usage to /examples/basic/.

I created this PR as a draft first, since I'd like to first discuss if it's even a good idea.
This is not a breaking change in any way and shouldn't be hard at all to maintain, so I don't think it has any downsides.
This also created a base for easily implementing even more custom events in the future.

One todo would maybe be to include the coordinates in the event at what place the firework exploded.

Checklist

@crashmax-dev crashmax-dev added enhancement New feature or request v2.x labels Apr 17, 2023
@crashmax-dev crashmax-dev changed the title adding custom event handler feat: adding custom event handler Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v2.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants