How do I draw a semi-transparent shape that "overwrites" other shapes? #1476
Unanswered
pastelmind
asked this question in
Q&A
Replies: 1 comment 2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to draw a semi-transparent shape over other shapes such that it "overwrites" them completely, rather than blending. (The problem is better explained in this StackOverflow question)
What I want:
What I don't want:
This can be easily achieved via compositing: draw the same shape twice, using
destination-out
thensource-over
as theglobalCompositeOperation
.In vanilla JS, this looks like:
This allows me to avoid calling
ctx.arc()
or other path drawing methods.How do I do this in Konva? I'd like to avoid creating two identical shapes, as it would require synchronizing them when one is dragged or clicked. Is it possible with a single shape?
Beta Was this translation helpful? Give feedback.
All reactions