mask¶
- class janim.items.effect.mask.ShapeMask(*items, shape: Item, alpha: float = 1.0, feather: float = 0.0, invert: bool = False, root_only: bool = False, **kwargs)¶
Bases:
AppliedGroupCreate a masking effect using
shapeas the outlineFor the passed items, only the parts inside the shape will be shown
- Parameters:
shape – Mask shape; if it has descendant items, the descendant shapes are combined using XOR
alpha – Overall mask opacity, in the range
0.0 ~ 1.0feather – Edge feather size; the larger the value, the blurrier it becomes; numerically, it is reflected as the distance on both sides of the feathered region
invert – Invert the mask;
0.0is normal and1.0is fully inverted
text = Text('Hello').show() mask = ShapeMask(text, shape=Circle(radius=2), feather=0.2) mask.show()
If you want
shapeto use the union of its descendant items, seefrom_group(), for example:ShapeMask(..., shape=boolean_ops.Union.from_group(shape))
Nested masks, like
FrameEffect, require explicitly nestingShapeMaskobjects:mask1 = ShapeMask(..., shape=shape1).show() mask2 = ShapeMask(mask1, shape=shape2).show()
- renderer_cls¶
alias of
ShapeMaskRenderer
- points¶
- alpha¶
- feather¶
- invert¶