Repository navigation
Add solid start-region shapes: SOLID_RECT and SOLID_OVAL - #26
Merged
Merged
Conversation
Add filled start-region variants so particles can spawn from anywhere inside the area, not just the perimeter. SOLID_RECT samples uniformly in the box; SOLID_OVAL samples uniformly over the ellipse's area using the sqrt(random) radius trick to avoid center clustering. Existing OVAL/RECT outline behavior is unchanged and the change is additive. isInsideStartRegion (used by hideInStartRegion) now handles both solid shapes, reusing the interior tests of their outline counterparts. Add a Disintegrate sample demonstrating the new shapes: tap a solid blue shape to blow it apart, with a shape toggle (SOLID_RECT/SOLID_OVAL), an edge-behavior toggle (None/Bounce, damping 0.3), and a particle-count slider. Document the shapes in the README. Closes #24 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Adds filled start-region shapes so particles can spawn from anywhere inside the area, not just the outline. Closes #24.
SOLID_RECT— random point uniformly inside thewidth × heightbox.SOLID_OVAL— random point uniformly over the ellipse's area, using thesqrt(random())radius trick so it isn't center-biased.Existing
OVAL/RECT(outline) behavior is unchanged; the solid variants are additive and non-breaking.isInsideStartRegion(used byhideInStartRegion) now handles both solid shapes, reusing the interior tests of their outline counterparts.Sample
New Disintegrate sample demonstrating the feature: tap a solid blue shape to blow it apart into particles that fall under gravity.
SOLID_RECT↔SOLID_OVAL(rendered as a circle).None↔Bounce(damping = 0.3).💥 Boom→↻ Recreate.Docs
Shapeenum entries,startPoint, andstartRegionSize.hideInStartRegionnote.Testing
:particle-emitter:compileKotlinMetadataand:samples:shared:compileCommonMainKotlinMetadatacompile cleanly.Bounce(0.3)makes particles settle along the bottom edge.🤖 Generated with Claude Code