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)¶
基类:
AppliedGroup以
shape为轮廓做一个蒙板效果对于传入的物件,只会显示形状内部的部分
- 参数:
shape -- 蒙板图形,若带有后代物件,则将若干后代物件图形作 XOR
alpha -- 蒙板整体透明度,范围
0.0 ~ 1.0feather -- 边缘羽化大小,值越大越模糊;数值上体现为羽化部分的两侧的距离
invert -- 反转蒙板,
0.0为正常,1.0为完全反转
text = Text('Hello').show() mask = ShapeMask(text, shape=Circle(radius=2), feather=0.2) mask.show()
若
shape要使用后代物件的并,可参考from_group(),例如ShapeMask(..., shape=boolean_ops.Union.from_group(shape))
嵌套蒙板和
FrameEffect一样,需要显式嵌套ShapeMask对象:mask1 = ShapeMask(..., shape=shape1).show() mask2 = ShapeMask(mask1, shape=shape2).show()
- renderer_cls¶
- points¶
- alpha¶
- feather¶
- invert¶