-
Notifications
You must be signed in to change notification settings - Fork 301
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
Add support for custom shapes #129
Add support for custom shapes #129
Conversation
c48cf99
to
8e38b73
Compare
Hi @mattprecious, thanks for the PR! I've been holding back adding custom shapes to Konfetti in order to keep it performant. First of all I have to say that I'm really happy with the code that you delivered including the improvements. At first glance it looks great! Give me some more time to review the code and play with some custom shapes. Main goal is to make sure everything stays performant so I also want to run some tests but looking at the implementation I think it'll be fine! Really cool |
Yep, keeping the performance is definitely important. I tried to keep it as lightweight as possible by sticking with the canvas APIs, but let me know if you find anything that needs addressing. It's definitely possible to build a poorly-performing shape implementation, but I think that's fine as long as the built-in ones work well. |
One thing I noticed with this change is that since you can now use shapes that aren't symmetrical both vertically and horizontally, it's very clear that they only flip along the horizontal axis. |
Just checked that indeed and you're right. I think that's fine for now. Letting people know the rotation effect looks best with symmetrical shapes is good enough for now. Adding this is already a major step forwards and requested by a lot of people. 🙂 |
8e38b73
to
4fb5a21
Compare
@mattprecious Can I or do you want to rebase the branch on master? |
Go for it! |
0200f93
to
427d0e6
Compare
Closes #11
Main API change is a switch of the
Shape
type from an enum to an interface. With an interface, consumers are free to create whatever shape they want, so long as they can draw it using canvas operations. I also added rectangles and drawables as built-in shape implementations.