data

class janim.components.data.Cmpt_Data

See ValueTracker for details

copy() Self
become(other: Cmpt_Data) Self
not_changed(other: Cmpt_Data) bool
classmethod align_for_interpolate(cmpt1: Cmpt_Data, cmpt2: Cmpt_Data) AlignedData[Self]
interpolate(cmpt1: Cmpt_Data, cmpt2: Cmpt_Data, alpha: float, *, path_func=None) None
set(value: T) Self

Set current value

get() T

Get current value

increment(value: T) Self

Increment the value by value; only works for some simple types

update(patch: T) Self

Partially update the original dictionary based on the given dictionary

set_func(copy_func: CopyFn[T] | None = None, not_changed_func: NotChangedFn[T] | None = None, interpolate_func: InterpolateFn[T] | None = None) Self
class IsinstanceResolver
register(isinstance_check: ClassInfo, resolved: T) None
update_cache(value, resolved: T) None
resolve(value) T | None
clear_cache() None
static register_funcs(isinstance_check: ClassInfo, copy_func: CopyFn, not_changed_func: NotChangedFn, interpolate_func: InterpolateFn) None
static copy_for_value(value: T) T
static check_not_changed_for_value(a: T, b: T) bool
static interpolate_for_value(a: T, b: T, alpha: float) T
static register_update_func(isinstance_check: ClassInfo, update_func: UpdateFn) None
static update_for_value(state: T, patch: T) T
class janim.components.data.CustomData

Used for example:

class PhysicalBlock(Square):
    physic = CustomData()

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.physic.set({
            'speed': ORIGIN,    # stationary by default
            'accel': ORIGIN,    # and has no acceleration
        })

You can refine the type annotations

from typing import TypedDict

class PhysicData(TypedDict):
    speed: np.ndarray
    accel: np.ndarray

class PhysicalBlock(Square):
    physic = CustomData[Self, PhysicData]()

    ...
exception janim.components.data.TrackerShapeError(message: str, *, missing: set | None = None, extra: set | None = None)
source_cls_name_ctx: ContextVar = <ContextVar name='config_ctx_var'>
static get_source_cls_name() str