handanim.animations package

Submodules

handanim.animations.fade module

class handanim.animations.fade.FadeInAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: AnimationEvent

A class representing a fade-in animation event that gradually increases the opacity of elements.

This animation applies a progressive opacity change from 0 to 1 over a specified duration, creating a smooth fade-in effect for graphical elements.

Parameters:
  • start_time (float, optional) – The time at which the animation begins. Defaults to 0.

  • duration (float, optional) – The total duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional function to modify the animation’s progress curve. Defaults to None.

  • data (dict, optional) – Additional data associated with the animation. Defaults to None.

apply(opsset: OpsSet, progress: float)

Applies the progress percentage of the given animation event to the given opsset

class handanim.animations.fade.FadeOutAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: FadeInAnimation

A class representing a fade-out animation event that gradually decreases the opacity of elements.

This animation applies a progressive opacity change from 1 to 0 over a specified duration, creating a smooth fade-out effect for graphical elements.

Parameters:
  • start_time (float, optional) – The time at which the animation begins. Defaults to 0.

  • duration (float, optional) – The total duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional function to modify the animation’s progress curve. Defaults to None.

  • data (dict, optional) – Additional data associated with the animation. Defaults to None.

apply(opsset, progress)

Applies the progress percentage of the given animation event to the given opsset

handanim.animations.sketch module

class handanim.animations.sketch.SketchAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: AnimationEvent

A class representing a sketch animation event that progressively renders drawing operations.

This animation supports partial rendering of drawing and fill operations with configurable timing and optional glowing dot effects. It allows for smooth, incremental visualization of drawing sequences.

wait_before_fill

Delay in seconds before starting fill animation, capped at half the total duration.

Type:

float

get_partial_sketch()

Calculates a partial OpsSet representing the current sketching progress.

apply()

Applies the sketch animation to a given OpsSet at a specific progress point.

apply(opsset: OpsSet, progress: float)

Apply the sketch animation to an operation set with a given progress.

This method progressively renders the operations in the opsset based on the current animation progress, with an optional glowing dot effect to highlight the current drawing point.

Parameters:
  • opsset (OpsSet) – The set of operations to animate

  • progress (float) – Animation progress from 0.0 to 1.0

Returns:

A new operation set with partially or fully rendered operations

Return type:

OpsSet

get_partial_sketch(opsset: OpsSet, progress: float) OpsSet

Calculate a partial OpsSet representing the sketching progress of an operation set.

Parameters:
  • OpsSet – The full drawn opsset on which to apply partial sketching

  • progress (float) – The progress of sketching, ranging from 0.0 to 1.0.

Returns:

A new OpsSet containing the operations up to the specified progress point,

with the last operation potentially being partially completed.

Return type:

OpsSet

handanim.animations.translate module

class handanim.animations.translate.TranslateFromAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: TranslateToAnimation

A class representing a translate from a point animation event.

This animation translates an OpsSet from a specified point to its current center of gravity over the course of the animation’s duration, using an optional easing function.

Inherits from TranslateToAnimation and reverses the progress to achieve the “from” translation effect.

Parameters:
  • start_time (float, optional) – The start time of the animation. Defaults to 0.

  • duration (float, optional) – The duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional easing function to modify animation progress. Defaults to None.

  • data (dict, optional) – A dictionary containing animation data, including the starting ‘point’. Defaults to None.

apply()

Applies the translation from the specified point to the OpsSet’s center of gravity.

apply(opsset, progress)

Applies the progress percentage of the given animation event to the given opsset

class handanim.animations.translate.TranslateToAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: AnimationEvent

A class representing a translate to a point animation event.

This animation translates an OpsSet from its current center of gravity to a specified point over the course of the animation’s duration, using an optional easing function.

Parameters:
  • start_time (float, optional) – The start time of the animation. Defaults to 0.

  • duration (float, optional) – The duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional easing function to modify animation progress. Defaults to None.

  • data (dict, optional) – A dictionary containing animation data, including the target ‘point’. Defaults to None.

_opsset_apply()

Calculates and applies the translation of the OpsSet.

apply()

Applies the translation to the given OpsSet at the specified progress.

apply(opsset: OpsSet, progress: float)

Applies the progress percentage of the given animation event to the given opsset

handanim.animations.zoom module

class handanim.animations.zoom.ZoomInAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: AnimationEvent

A class representing a zoom-in animation event that scales an OpsSet progressively.

This animation scales the operations set from its original size to a larger size based on the provided progress value. It is typically used for creating or expanding visual elements.

Parameters:
  • start_time (int, optional) – The start time of the animation. Defaults to 0.

  • duration (int, optional) – The duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional easing function to modify the animation progress. Defaults to None.

  • data (Any, optional) – Additional data associated with the animation. Defaults to None.

apply(opsset, progress)

Applies the progress percentage of the given animation event to the given opsset

class handanim.animations.zoom.ZoomOutAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: ZoomInAnimation

A class representing a zoom-out animation event that scales an OpsSet progressively.

This animation scales the operations set from its current size to a smaller size based on the provided progress value. It is typically used for shrinking or removing visual elements.

Parameters:
  • start_time (int, optional) – The start time of the animation. Defaults to 0.

  • duration (int, optional) – The duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional easing function to modify the animation progress. Defaults to None.

  • data (Any, optional) – Additional data associated with the animation. Defaults to None.

apply(opsset, progress)

Applies the progress percentage of the given animation event to the given opsset

Module contents

class handanim.animations.FadeInAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: AnimationEvent

A class representing a fade-in animation event that gradually increases the opacity of elements.

This animation applies a progressive opacity change from 0 to 1 over a specified duration, creating a smooth fade-in effect for graphical elements.

Parameters:
  • start_time (float, optional) – The time at which the animation begins. Defaults to 0.

  • duration (float, optional) – The total duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional function to modify the animation’s progress curve. Defaults to None.

  • data (dict, optional) – Additional data associated with the animation. Defaults to None.

apply(opsset: OpsSet, progress: float)

Applies the progress percentage of the given animation event to the given opsset

class handanim.animations.FadeOutAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: FadeInAnimation

A class representing a fade-out animation event that gradually decreases the opacity of elements.

This animation applies a progressive opacity change from 1 to 0 over a specified duration, creating a smooth fade-out effect for graphical elements.

Parameters:
  • start_time (float, optional) – The time at which the animation begins. Defaults to 0.

  • duration (float, optional) – The total duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional function to modify the animation’s progress curve. Defaults to None.

  • data (dict, optional) – Additional data associated with the animation. Defaults to None.

apply(opsset, progress)

Applies the progress percentage of the given animation event to the given opsset

class handanim.animations.SketchAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: AnimationEvent

A class representing a sketch animation event that progressively renders drawing operations.

This animation supports partial rendering of drawing and fill operations with configurable timing and optional glowing dot effects. It allows for smooth, incremental visualization of drawing sequences.

wait_before_fill

Delay in seconds before starting fill animation, capped at half the total duration.

Type:

float

get_partial_sketch()

Calculates a partial OpsSet representing the current sketching progress.

apply()

Applies the sketch animation to a given OpsSet at a specific progress point.

apply(opsset: OpsSet, progress: float)

Apply the sketch animation to an operation set with a given progress.

This method progressively renders the operations in the opsset based on the current animation progress, with an optional glowing dot effect to highlight the current drawing point.

Parameters:
  • opsset (OpsSet) – The set of operations to animate

  • progress (float) – Animation progress from 0.0 to 1.0

Returns:

A new operation set with partially or fully rendered operations

Return type:

OpsSet

get_partial_sketch(opsset: OpsSet, progress: float) OpsSet

Calculate a partial OpsSet representing the sketching progress of an operation set.

Parameters:
  • OpsSet – The full drawn opsset on which to apply partial sketching

  • progress (float) – The progress of sketching, ranging from 0.0 to 1.0.

Returns:

A new OpsSet containing the operations up to the specified progress point,

with the last operation potentially being partially completed.

Return type:

OpsSet

class handanim.animations.TranslateFromAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: TranslateToAnimation

A class representing a translate from a point animation event.

This animation translates an OpsSet from a specified point to its current center of gravity over the course of the animation’s duration, using an optional easing function.

Inherits from TranslateToAnimation and reverses the progress to achieve the “from” translation effect.

Parameters:
  • start_time (float, optional) – The start time of the animation. Defaults to 0.

  • duration (float, optional) – The duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional easing function to modify animation progress. Defaults to None.

  • data (dict, optional) – A dictionary containing animation data, including the starting ‘point’. Defaults to None.

apply()

Applies the translation from the specified point to the OpsSet’s center of gravity.

apply(opsset, progress)

Applies the progress percentage of the given animation event to the given opsset

class handanim.animations.TranslateToAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: AnimationEvent

A class representing a translate to a point animation event.

This animation translates an OpsSet from its current center of gravity to a specified point over the course of the animation’s duration, using an optional easing function.

Parameters:
  • start_time (float, optional) – The start time of the animation. Defaults to 0.

  • duration (float, optional) – The duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional easing function to modify animation progress. Defaults to None.

  • data (dict, optional) – A dictionary containing animation data, including the target ‘point’. Defaults to None.

_opsset_apply()

Calculates and applies the translation of the OpsSet.

apply()

Applies the translation to the given OpsSet at the specified progress.

apply(opsset: OpsSet, progress: float)

Applies the progress percentage of the given animation event to the given opsset

class handanim.animations.ZoomInAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: AnimationEvent

A class representing a zoom-in animation event that scales an OpsSet progressively.

This animation scales the operations set from its original size to a larger size based on the provided progress value. It is typically used for creating or expanding visual elements.

Parameters:
  • start_time (int, optional) – The start time of the animation. Defaults to 0.

  • duration (int, optional) – The duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional easing function to modify the animation progress. Defaults to None.

  • data (Any, optional) – Additional data associated with the animation. Defaults to None.

apply(opsset, progress)

Applies the progress percentage of the given animation event to the given opsset

class handanim.animations.ZoomOutAnimation(start_time=0, duration=0, easing_fun=None, data=None)

Bases: ZoomInAnimation

A class representing a zoom-out animation event that scales an OpsSet progressively.

This animation scales the operations set from its current size to a smaller size based on the provided progress value. It is typically used for shrinking or removing visual elements.

Parameters:
  • start_time (int, optional) – The start time of the animation. Defaults to 0.

  • duration (int, optional) – The duration of the animation. Defaults to 0.

  • easing_fun (callable, optional) – An optional easing function to modify the animation progress. Defaults to None.

  • data (Any, optional) – Additional data associated with the animation. Defaults to None.

apply(opsset, progress)

Applies the progress percentage of the given animation event to the given opsset