depth

class janim.components.depth.Cmpt_Depth(value: float, order: int | None = None)

基类:Component, Generic

深度组件

  • 如果某个对象的深度值更小,那么它在 >< 的判断中也就更小

  • 如果两个对象的深度值相同,那么后创建的对象在 >< 的判断中更小

被用于绘制时,也就是说:

  • 深度大的会被深度小的遮盖

  • 深度一样时,先创建的会被后创建的遮盖

例:

d1 = Depth(0)
d2 = Depth(2)
d3 = Depth(2)

print(d1 < d3)  # True
print(d2 < d3)  # False
print(d2 > d3)  # True

上面这个例子的绘制顺序(从最早被绘制的到最迟被绘制的):

d2、d3、d1

也就是 d3 会盖住 d2;d1 会盖住 d2 和 d3

copy() Self
become(other: Cmpt_Depth) Self
not_changed(other: Cmpt_Depth) bool
classmethod align_for_interpolate(cmpt1: Cmpt_Depth, cmpt2: Cmpt_Depth)
interpolate(cmpt1: Cmpt_Depth, cmpt2: Cmpt_Depth, alpha: float, *, path_func=None) None
set(value: float, order: int | None = None, *, root_only: bool = False) Self

设置物件的深度

get() float
get_raw() tuple[float, int | float]

返回元组 (depth, order)

在一些特殊情况下,order 可能是浮点数

arrange(depth: float | None = None) Self

将子物件排序深度