zodiac (complete rewrite) - #15
Open
indus wants to merge 4 commits into
Open
Conversation
Owner
|
Thanks @indus, this looks really cool. I won't merge the pull request wholesale into Particleground due to the removal of jQuery, removal of functionality I consider important (e.g. pause and destroy methods) and renaming of the library, but I'd love to cherry pick some of your ideas, especially those which improve rendering performance. |
Author
|
Sure! You are welcome. If you have questions or you find bugs feel free to contact me. |
Owner
|
Yeah of course, go right ahead and start a new repo for Zodiac :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
a complete rewrite of particleground.js
only a third file size (to be fair: without jQuery-stuff and, raf polyfill), better performance, and some additional options.
even if it has almost no impact on the performance, code like this...
...is bloat! What is wrong with:
The thing that really hits performance is the drawing routine. It is possible to only call
ctx.stroke()once in a frame and leave the ctx style properties totally untouched, combine positioning and drawing into a single loop, avoid clunky Particle-Objects, and the ugly switch statements,even if there is no equal codebase anymore, you maybe want to merge some of these _ideas_ into your library:
orientationSupport && !desktop- when you get a proper event in the callback, you know that you have supportpointerX - (winW / 2)could be calculated in the mousemove and orientation handler)stackPosthing and just use the index of the array you keep the particles in.