my intention is to draw semi-circular inner shadows inside circular shapes that represent planets moving around a star (this is part of an educational program I'm working on).
After many approaches, this was the one that almost worked for me:
- Draw a circular shape (planet) and over it, stroke a larger circle that contains the actual shadow.
2. Using the composition option "ctx.globalCompositeOperation='source-atop';" to draw the bigger circle it will only paint the portion that overlaps the existing content:
But the problem is that any planet will overlap any shadow circle, so, as you can see, when a planet overlaps the bigger shadow it turns totally dark.
Is there any way to make it draw the overlap area of a specific content (shape)?
Or, do you know a better way to do this? Remember I must paint the shadow in the specific angle from the planet to the light source.
Thanks in advance!

Try to call
clipmethod (and related codes) before drawing "shadow" onto planet like this.