item¶
- janim.items.item.mockable(func)¶
使得
.astype后可以调用被@mockable修饰的方法
- class janim.items.item.Item(*args, children: list[Item] | None = None, **kwargs)¶
-
Item是物件的基类除了使用
item[0]item[1]进行下标索引外,还可以使用列表索引和布尔索引列表索引,例如
item[0, 1, 3], 即Group(item[0], item[1], item[3])布尔索引,例如
item[False, True, False, True, True]表示取出Group(item[1], item[3], item[4]),也就是将那些为 True 的位置取出组成一个
Group
- depth¶
- broadcast_refresh_of_component(cmpt: Component, func: Callable | str, recurse_up=False, recurse_down=False) Self¶
为
mark_refresh()进行recurse_up/down的处理
- set(**styles) None¶
设置物件以及子物件的样式,与
apply_styles()只影响自身不同的是,该方法也会影响所有子物件
- digest_styles(**styles) None¶
- classmethod get_available_styles() list[str]¶
- set_style(depth: float | None = None, **kwargs) Self¶
- do(func: Callable[[Self], Any]) Self¶
使用
func对物件进行操作,并返回self以方便链式调用
- is_null() bool¶
- property anim: Self¶
例如:
self.play( item.anim.points.scale(2).r.color.set('green') )
该例子会创建将
item缩放 2 倍并且设置为绿色的补间动画并且可以向动画传入参数:
self.play( item.anim(duration=2, rate_func=linear) .points.scale(2).r.color.set('green') )
.r表示从组件回到物件,这样就可以调用其它组件的功能
- astype(cls: type[T]) T¶
使得可以调用当前物件中没有的组件
例:
group = Group( Rect() Circle() )
在这个例子中,并不能
group.color.set(BLUE)来设置子物件中的颜色, 但是可以使用group.astype(VItem).color.set(BLUE)来做到也可以使用简写
group(VItem).color.set(BLUE)
- get_parents()¶
- get_children()¶
- not_changed(other: Self) bool¶
- current(*, as_time: float | None = None, skip_dynamic=False) Self¶
当前物件
如果此时在回放和 Updater 中,则返回对应时间的历史物件
在其余情况下,包括该物件没有历史记录的情况,则返回物件自身
- copy(*, root_only=False, as_time: float | None = None, skip_dynamic: bool = False) Self¶
复制物件
- store() Self¶
- classmethod align_for_interpolate(item1: Item, item2: Item) AlignedData[Self]¶
进行数据对齐,以便插值
- interpolate(item1: ~janim.items.item.Item, item2: ~janim.items.item.Item, alpha: float, *, path_func: PathFunc = <function straight_path>) None¶
进行插值(仅对该物件进行,不包含后代物件)
- apart_alpha(n: int) None¶
- cmpt_init_datas = {'depth': _ItemMeta._CmptInitData(info=<janim.components.component.CmptInfo object>, decl_cls=<class 'janim.items.item.Item'>)}¶
- fix_in_frame(on: bool = True, *, root_only: bool = False) Self¶
固定在屏幕上,也就是即使摄像头移动位置也不会改变在屏幕上的位置
- is_fix_in_frame() bool¶
- classmethod get_global_renderer() None¶
- create_renderer() None¶
- render() None¶
- show(**kwargs) Self¶
显示物件
- hide(**kwargs) Self¶
隐藏物件