OnInit

Qualified name: algan.animation\_timeline.animation\_contexts.OnInit

class OnInit(func, **kwargs)[source]

Bases: AnimationContext

Run a function over every Mob constructed inside the block.

A hook for applying the same setup to a batch of Mobs without repeating it – a shared material, a starting position, a shader.

Parameters:
  • func – Callable taking one Mob, called as each Mob inside the block is constructed.

  • **kwargs (Any) – Passed to AnimationContext.

Examples

with OnInit(lambda mob: mob.set_material(MeshStandardMaterial())):
    shapes = [Sphere() for _ in range(3)]

Methods

on_init_extra

Apply this context's function to a newly constructed Mob.

Attributes

animation_manager

child_contexts

combine_easing

composed_easing

current_time

Where the authoring cursor sits within this context, in seconds.

easing

end_time

The furthest time anything recorded in this context reaches, in seconds.

equalize_runtimes

finished

kwargs

lag_ratio

new_animation

new_mobs

prev_context

priority_level

record_attr_modifications

record_funcs

runtime

runtime_per_part

spawn_at_end

on_init_extra(animatable)[source]

Apply this context’s function to a newly constructed Mob.

Parameters:

animatable – The Mob that was just constructed.