Skip to content

Add solid start-region shapes: SOLID_RECT and SOLID_OVAL - #26

Merged
PiotrPrus merged 1 commit into
mainfrom
feat/solid-start-region-shapes
Jul 3, 2026
Merged

PiotrPrus merged 1 commit into
mainfrom
feat/solid-start-region-shapes

Conversation

@PiotrPrus

Copy link
Copy Markdown
Owner

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 the width × height box.
  • SOLID_OVAL — random point uniformly over the ellipse's area, using the sqrt(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 by hideInStartRegion) 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.

  • Shape toggle — SOLID_RECT ↔ SOLID_OVAL (rendered as a circle).
  • Edge-behavior toggle — None ↔ Bounce(damping = 0.3).
  • Particle-count slider (50–1500) controlling the burst size.
  • Single state-driven button: 💥 Boom → ↻ Recreate.

Docs

  • KDoc on the Shape enum entries, startPoint, and startRegionSize.
  • README: features list, a new Start Region Shapes table covering all shapes, and an updated hideInStartRegion note.

Testing

  • :particle-emitter:compileKotlinMetadata and :samples:shared:compileCommonMainKotlinMetadata compile cleanly.
  • Verified live on a Pixel 9a emulator: both solid shapes emit from the whole filled area, the count slider changes burst density, and Bounce(0.3) makes particles settle along the bottom edge.

🤖 Generated with Claude Code

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>
@PiotrPrus
PiotrPrus merged commit 4f61d9f into main Jul 3, 2026
6 checks passed
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

Successfully merging this pull request may close these issues.

Add solid (filled) start-region shapes: SOLID_RECT and SOLID_OVAL

1 participant