manim.animation.transform_matching_parts.TransformMatchingAbstractBase

class TransformMatchingAbstractBase(mobject, target_mobject, transform_mismatches=False, fade_transform_mismatches=False, key_map=None, **kwargs)[source]

Bases: manim.animation.composition.AnimationGroup

Abstract base class for transformations that keep track of matching parts.

Subclasses have to implement the two static methods get_mobject_parts() and get_mobject_key().

Basically, this transformation first maps all submobjects returned by the get_mobject_parts method to certain keys by applying the get_mobject_key method. Then, submobjects with matching keys are transformed into each other.

Parameters
  • mobject (Mobject) – The starting Mobject.

  • target_mobject (Mobject) – The target Mobject.

  • transform_mismatches (bool) – Controls whether submobjects without a matching key are transformed into each other by using Transform. Default: False.

  • fade_transform_mismatches (bool) – Controls whether submobjects without a matching key are transformed into each other by using FadeTransform. Default: False.

  • key_map (Optional[dict]) – Optional. A dictionary mapping keys belonging to some of the starting mobject’s submobjects (i.e., the return values of the get_mobject_key method) to some keys belonging to the target mobject’s submobjects that should be transformed although the keys don’t match.

  • kwargs – All further keyword arguments are passed to the submobject transformations.

Note

If neither transform_mismatches nor fade_transform_mismatches are set to True, submobjects without matching keys in the starting mobject are faded out in the direction of the unmatched submobjects in the target mobject, and unmatched submobjects in the target mobject are faded in from the direction of the unmatched submobjects in the start mobject.

Methods

clean_up_from_scene

get_mobject_key

get_mobject_parts

get_shape_map