types

class janim.items.three_d.types.SurfaceFace(*args, **kwargs)

基类:Polygon

VCheckerboardSurface 的每个面

class janim.items.three_d.types.NormSurface(geometry: T, resolution: Resolution | None = None, epsilon: float = 0.001, **kwargs)

基类:Points, Generic

CheckerboardSurfaceSmoothSurface 的基类

提供了对 du_pointsdv_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

棋盘格样式的曲面,默认着色为蓝色深浅交替网格

备注

该样式的曲面在半透明情况下的表现有待完善

备注

该样式的曲面作为整体渲染,因此无法将每个面作为单独的物件进行操作

对于每个面以独立物件存在的形式,请参考 VCheckerboardSurface

参数:
  • geometry -- 由 SurfaceGeometry.into() 自动提供

  • resolution -- 覆盖默认分辨率设置,可传入单个值或者传入一对值来表示在 uv 方向的分辨率

  • checkerboard_colors -- 棋盘格颜色列表,会对网格循环使用其中的颜色

resolution_type: str | None = 'face'
color
renderer_cls

CheckerboardSurfaceRenderer 的别名

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

棋盘格样式的曲面,默认着色为蓝色深浅交替网格

警告

由于该样式的曲面的每个网格面都是独立的 VItem 物件,因此性能普遍较差

对于性能较优的方式,请参考 CheckerboardSurface

参数:
  • geometry -- 由 SurfaceGeometry.into() 自动提供

  • resolution -- 覆盖默认分辨率设置,可传入单个值或者传入一对值来表示在 uv 方向的分辨率

  • 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 -- 覆盖默认分辨率设置,可传入单个值或者传入一对值来表示在 uv 方向的分辨率

  • 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 -- 覆盖默认分辨率设置,可传入单个值或者传入一对值来表示在 uv 方向的分辨率

resolution_type: str | None = 'smooth'
class Cmpt_SurfaceRgba(*args, **kwargs)

基类:Cmpt_Rgba, Generic

DEFAULT_RGBA_ARRAY = <janim.utils.data.Array object>
color
renderer_cls

SmoothSurfaceRenderer 的别名

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 -- 覆盖默认分辨率设置,可传入单个值或者传入一对值来表示在 uv 方向的分辨率

  • 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

根据曲面几何信息构造出指定类型的物件

可使用:

示例:

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]