types¶
- class janim.items.three_d.types.SurfaceFace(*args, **kwargs)¶
基类:
PolygonVCheckerboardSurface的每个面
- class janim.items.three_d.types.NormSurface(geometry: T, resolution: Resolution | None = None, epsilon: float = 0.001, **kwargs)¶
基类:
Points,GenericCheckerboardSurface和SmoothSurface的基类提供了对
du_points和dv_points的封装,以便计算法向量- resolution_type: str | None = None¶
- init_connect() None¶
- classmethod align_for_interpolate(item1: Item, item2: Item) AlignedData[Self]¶
依照 uv 网格对齐采样分辨率以及三角形索引,而不是像原先一样简单逐点对齐
- class janim.items.three_d.types.CheckerboardSurface(geometry: T, resolution: Resolution | None = None, checkerboard_colors: ColorArray = ['#29ABCA', '#1C758A'], alpha: float = 1.0, epsilon: float = 0.001, **kwargs)¶
基类:
NormSurface,Generic棋盘格样式的曲面,默认着色为蓝色深浅交替网格
备注
该样式的曲面在半透明情况下的表现有待完善
- 参数:
geometry -- 由
SurfaceGeometry.into()自动提供resolution -- 覆盖默认分辨率设置,可传入单个值或者传入一对值来表示在
u和v方向的分辨率checkerboard_colors -- 棋盘格颜色列表,会对网格循环使用其中的颜色
- resolution_type: str | None = 'face'¶
- color¶
- renderer_cls¶
- apply_style(color: JAnimColor | ColorArray | None = None, alpha: float | None = None, **kwargs) Self¶
设置物件自身的样式,不影响子物件
另见:
set()
- class janim.items.three_d.types.VCheckerboardSurface(geometry: T, resolution: Resolution | None = None, fill_color: JAnimColor | None = None, fill_alpha: float = 1.0, checkerboard_colors: ColorArray = ['#29ABCA', '#1C758A'], stroke_color: JAnimColor = '#BBBBBB', stroke_radius: float = 0.0025, should_make_jagged: bool = False, **kwargs)¶
基类:
Group[SurfaceFace],VItem,Generic棋盘格样式的曲面,默认着色为蓝色深浅交替网格
- 参数:
geometry -- 由
SurfaceGeometry.into()自动提供resolution -- 覆盖默认分辨率设置,可传入单个值或者传入一对值来表示在
u和v方向的分辨率checkerboard_colors -- 棋盘格颜色列表,会对网格循环使用其中的颜色
stroke_color -- 网格边线颜色
stroke_radius -- 网格边线粗细
- set_fill_by_checkerboard(*colors: JAnimColor, alpha: float | None = None) Self¶
以棋盘网格的样式设置填充色
- 参数:
colors -- 用于交替填充的颜色序列(按顺序循环使用),例如只有两个颜色时即为经典的棋盘网格样式
alpha -- 填充透明度;若为
None则保持当前透明度不变
- classmethod align_for_interpolate(item1: CheckerboardSurface, item2: CheckerboardSurface) AlignedData[Self]¶
依照 uv 网格对齐棋盘格物件,而不是像原先一样简单逐个对齐
- get_children_in_grid() list[list[SurfaceFace]]¶
得到棋盘格二维数组,
v主序
- class janim.items.three_d.types.WireframeSurface(geometry: T, resolution: Resolution | None = None, stroke_color: JAnimColor = '#DDDDDD', stroke_radius: float = 0.005, depth_test: bool = False, should_make_smooth: bool = True, **kwargs)¶
基类:
Group[VItem],VItem,Generic线框样式的曲面
警告
由于该样式的曲面的每个线框都是独立的
VItem物件,因此性能普遍较差- 参数:
geometry -- 由
SurfaceGeometry.into()自动提供resolution -- 覆盖默认分辨率设置,可传入单个值或者传入一对值来表示在
u和v方向的分辨率stroke_color -- 线框颜色
stroke_radius -- 线框粗细
- classmethod align_for_interpolate(item1: WireframeSurface, item2: WireframeSurface) AlignedData[Self]¶
依照 uv 网格对齐线框,而不是像原先一样简单逐个对齐
- class janim.items.three_d.types.SmoothSurface(geometry: T, resolution: Resolution | None = None, epsilon: float = 0.001, **kwargs)¶
基类:
NormSurface,Generic平滑表面样式的曲面
备注
该样式的曲面在半透明情况下的表现有待完善
- 参数:
geometry -- 由
SurfaceGeometry.into()自动提供resolution -- 覆盖默认分辨率设置,可传入单个值或者传入一对值来表示在
u和v方向的分辨率
- resolution_type: str | None = 'smooth'¶
- class Cmpt_SurfaceRgba(*args, **kwargs)¶
基类:
Cmpt_Rgba,Generic- DEFAULT_RGBA_ARRAY = <janim.utils.data.Array object>¶
- color¶
- renderer_cls¶
- apply_style(color: JAnimColor | None = None, alpha: float | None = None, **kwargs) Self¶
设置物件自身的样式,不影响子物件
另见:
set()
- class janim.items.three_d.types.DotCloudSurface(geometry: T, resolution: Resolution | None = None, radius: float | Iterable[float] = 0.01, **kwargs)¶
基类:
DotCloud,Generic点集样式的曲面
- 参数:
geometry -- 由
SurfaceGeometry.into()自动提供resolution -- 覆盖默认分辨率设置,可传入单个值或者传入一对值来表示在
u和v方向的分辨率radius -- 每个点的半径大小,考虑到点会比较密集,因此这里的默认值会更小一些
- get_points_in_grid() ndarray¶
得到点集二维数组,
v主序
- classmethod align_for_interpolate(item1: DotCloudSurface, item2: DotCloudSurface) AlignedData[DotCloud]¶
依照 uv 网格对齐点,而不是像原先一样简单逐点对齐
- class janim.items.three_d.types.SurfaceGeometry(uv_func: Callable[[float, float], Vect], u_range: tuple[float, float], v_range: tuple[float, float], **kwargs)¶
基类:
object- RESOLUTIONS: dict[str, Resolution] = {'face': 32, 'smooth': 101}¶
- SURFACE_TYPES: dict[str, Any] = {'checker': <class 'janim.items.three_d.types.CheckerboardSurface'>, 'dots': <class 'janim.items.three_d.types.DotCloudSurface'>, 'smooth': <class 'janim.items.three_d.types.SmoothSurface'>, 'vchecker': <class 'janim.items.three_d.types.VCheckerboardSurface'>, 'wire': <class 'janim.items.three_d.types.WireframeSurface'>}¶
- into(mode: Literal['checker'], **kwargs) CheckerboardSurface[Self]¶
- into(mode: Literal['vchecker'], **kwargs) VCheckerboardSurface[Self]
- into(mode: Literal['wire'], **kwargs) WireframeSurface[Self]
- into(mode: Literal['smooth'], **kwargs) SmoothSurface[Self]
- into(mode: Literal['dots'], **kwargs) DotCloudSurface[Self]
- into(mode: type[T], **kwargs) T
根据曲面几何信息构造出指定类型的物件
可使用:
包括
'checker'、'vchecker'、'wire'、'smooth'、'dots'的字符串,我们一般使用这些他们分别对应
CheckerboardSurface、VCheckerboardSurface、WireframeSurface、SmoothSurface、DotCloudSurface可参考对应的文档说明
若使用一个自定义的物件类,其应至少接受一个
geometry参数
示例:
Sphere().into('checker')
对于不同类型物件特定的样式配置,放在
into或是几何构造(例如这里的Sphere())中均可Sphere().into('vchecker', fill_alpha=0.5)
Sphere(fill_alpha=0.5).into('vchecker')
- resolve_resolution(type: str, override: Resolution | None) tuple[int, int]¶