handanim.stylings package

Submodules

handanim.stylings.color module

handanim.stylings.fillpatterns module

class handanim.stylings.fillpatterns.HachureFillPattern(bound_box_list: ~typing.List[~typing.List[~typing.Tuple[float, float]]], fill_style: ~handanim.core.styles.FillStyle = <handanim.core.styles.FillStyle object>, sketch_style: ~handanim.core.styles.SketchStyle = <handanim.core.styles.SketchStyle object>)

Bases: DrawableFill

A base class for hachure fill patterns that renders fill lines for polygons.

This class provides methods to render hachure lines with a specific stroke style and sketch style. The render_fill_lines method converts a list of line points into drawable Line objects with the specified styling.

fill_style

Style parameters for the fill

Type:

FillStyle

sketch_style

Sketch style parameters for line rendering

Type:

SketchStyle, optional

render_fill_lines()

Converts line points to drawable Line objects

fill()

Generates hachure lines for a set of polygons and renders them

fill()
render_fill_lines(lines: List[List[Tuple[float, float]]]) OpsSet
class handanim.stylings.fillpatterns.HatchFillPattern(bound_box_list: ~typing.List[~typing.List[~typing.Tuple[float, float]]], fill_style: ~handanim.core.styles.FillStyle = <handanim.core.styles.FillStyle object>, sketch_style: ~handanim.core.styles.SketchStyle = <handanim.core.styles.SketchStyle object>)

Bases: HachureFillPattern

Generates a hatch fill pattern by rendering hachure lines at two perpendicular angles.

Creates an OpsSet with two sets of hachure lines rotated 90 degrees from each other, creating a criss-cross fill pattern. Preserves the original fill style after rendering.

Returns:

A set of drawing operations representing the hatch fill pattern.

Return type:

OpsSet

fill()
class handanim.stylings.fillpatterns.SolidFillPattern(bound_box_list, fill_style=Ellipsis, sketch_style=Ellipsis)

Bases: DrawableFill

A fill pattern implementation for solid color fills.

This class extends DrawableFill and provides a method to create a solid color fill for a given set of bounding boxes. It sets the pen color, opacity, and fills the specified geometric shapes by drawing lines connecting the box vertices.

bound_box_list

A list of bounding boxes to be filled

Type:

list

fill_style

Style parameters for the fill

Type:

FillStyle

sketch_style

Sketch style parameters

Type:

SketchStyle, optional

Returns:

A set of drawing operations to render the solid fill

Return type:

OpsSet

fill() OpsSet
handanim.stylings.fillpatterns.get_filler(bound_box_list: ~typing.List[~typing.List[~typing.Tuple[float, float]]], fill_style: ~handanim.core.styles.FillStyle = <handanim.core.styles.FillStyle object>, sketch_style=<handanim.core.styles.SketchStyle object>) DrawableFill

handanim.stylings.fonts module

handanim.stylings.fonts.get_font_path(font_name)

Get the path to a font

handanim.stylings.fonts.list_fonts()

List all available fonts

handanim.stylings.strokes module

handanim.stylings.strokes.apply_stroke_pressure(opsset: OpsSet, stroke_pressure: StrokePressure) OpsSet

This function applies different pressure to the strokes by interleaving different set pen operations with varying pressure values.

handanim.stylings.strokes.apply_strokes_gradient(opsset: OpsSet, start_color: Tuple[float, float, float], end_color: Tuple[float, float, float]) OpsSet

This function applies gradient coloring to the strokes by interleaving different set pen operations with varying color values.

handanim.stylings.utils module

handanim.stylings.utils.hachure_lines(polygon_list: List[List[Tuple[float, float]]], gap: float, angle: float, offset: float = 1)
handanim.stylings.utils.polygon_hachure_lines(polygon_list: ~typing.List[~typing.List[~typing.Tuple[float, float]]], fill_style=<handanim.core.styles.FillStyle object>, sketch_style=<handanim.core.styles.SketchStyle object>)
handanim.stylings.utils.rotate_points(points: List[Tuple[float, float]], center: Tuple[float, float], degrees: float) ndarray
handanim.stylings.utils.straight_hachure_lines(polygon_list: List[List[Tuple[float, float]]], gap: float, step_offset: float = 1)

Module contents