Skip to content

Claude/add mask documentation 01w6 g#2

Merged
laffan merged 4 commits intomainfrom
claude/add-mask-documentation-01w6G
Dec 28, 2025
Merged

Claude/add mask documentation 01w6 g#2
laffan merged 4 commits intomainfrom
claude/add-mask-documentation-01w6G

Conversation

@laffan
Copy link
Owner

@laffan laffan commented Dec 28, 2025

No description provided.

- Add Layer Masks section with interactive demo
- Create place-mask.js interactive example
- Document automatic mask application for groups
Phaser bitmap masks are positioned in global space and can be shared
across multiple game objects. The previous implementation created a
new mask image for each child, which was inefficient and caused
positioning issues.

- Add applySharedMaskToGroup() that creates ONE mask for ALL children
- Update place/index.ts to use shared mask approach
- Update spriteSetup.ts applyMaskToGroupChildren to use shared mask
Phaser's BitmapMask uses alpha channel, but PSD layer masks export as
grayscale (white=visible, black=hidden). Added convertLuminanceToAlpha()
to automatically convert the mask image at runtime.

- Create canvas, read pixel data, convert RGB luminance to alpha
- Cache converted texture with _alpha suffix to avoid re-conversion
- Fallback to original texture if conversion fails
@laffan laffan merged commit c8a5071 into main Dec 28, 2025
1 check 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.

2 participants