depth¶
- class janim.components.depth.Cmpt_Depth(value: float, order: int | None = None)¶
Bases:
Component,GenericDepth component
If an object has a smaller depth value, it is also smaller in
>and<comparisonsIf two objects have the same depth value, the later created object is smaller in
>and<comparisons
When used for rendering, that is:
Objects with larger depth will be covered by objects with smaller depth
When depths are the same, earlier created objects will be covered by later created ones
Example:
d1 = Depth(0) d2 = Depth(2) d3 = Depth(2) print(d1 < d3) # True print(d2 < d3) # False print(d2 > d3) # True
Rendering order for the above example (from earliest to latest rendered):
d2,d3,d1That is,
d3will coverd2;d1will cover bothd2andd3- 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¶
Set the depth of the item
- get() float¶
- get_raw() tuple[float, int | float]¶
Return tuple
(depth, order)In some special cases,
ordermay be a floating-point number
- arrange(depth: float | None = None) Self¶
Sort descendant items by depth