Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support masking (with transparency) like in SVG #1313

Open
s-light opened this issue Apr 19, 2017 · 4 comments
Open

support masking (with transparency) like in SVG #1313

s-light opened this issue Apr 19, 2017 · 4 comments

Comments

@s-light
Copy link

s-light commented Apr 19, 2017

source discussion on google groups

in SVG / Inkscape there is a Mask option:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Clip.html
https://www.w3.org/TR/SVG/masking.html#Masking

i have experimented with the clipMask and group.clipped property.
(would be good to include an example or link in the clipMask propertie in the documentation ;-) )
but it seems these do not support alpha/transparency - so they only clip.
example at sketch.paperjs.org
in line 80 you can un/re comment the clipping to see the different results.

@iconexperience
Copy link
Contributor

You can do masking by using blendMode: 'source-in' on groups.

Here is a sketch to illustrate how this can be done.

Content without mask:
image

Mask:
image

Content with mask applied:
image

@iconexperience
Copy link
Contributor

But unfortunately this uses the whole background as the mask. as you can see in this sketch that has a large opaque rectangle as the background.

@iconexperience
Copy link
Contributor

iconexperience commented Jun 15, 2017

Turns out you can do it by adding blendMode: 'source-over' to the masked group:

Here is the sketch

@Saket23
Copy link

Saket23 commented Apr 16, 2024

Group inside group adds up a lot of latency , is there any way we can avoid latency if we have nested Groups ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants