Skip to content

Animations for Registers and Elements

isa_manim.isa_animate.register_animate.decl_register declares registers by fading in all provided register objects.

isa_manim.isa_animate.register_animate.replace_register replaces one existing register with a new register by transform.

An example for decl_register and replace_register is as below:

Source code: test_reg_animation.py

isa_manim.isa_animate.register_animate.read_elem reads one data element from one register by fading the provided element in the specified position.

isa_manim.isa_animate.register_animate.assign_elem assigns one data element to one register by moving the data element to the specified location related to the provided register.

It is not required that the target element must share the same shape and color as the origin element.

An example for read_elem and assign_elem is as below:

Source code: test_elem_animation.py

See isa_manim.isa_objects.reg_unit.RegUnit.get_elem_pos and isa_manim.isa_objects.elem_unit.ElemUnit.get_elem_pos for detail about how to index one element within one register unit or one element unit.

isa_manim.isa_animate.register_animate.replace_elem replaces the existing data element with a new data element by transform.

The above functions generate a sequence of animations, but they do not register animation to Manim unless play() is applied on the result values

register_animate

Animation with Registers and Elements.

assign_elem(old_elem, new_elem, vector, index, reg_idx, offset)

Assign one element to the register. Move element to the specified location related to the register.

Instead of move animation, this function uses transform animation. new_elem can use different width, color, and value from the old_elem.

Parameters:

Name Type Description Default
old_elem ElemUnit

Element object before animation.

required
new_elem ElemUnit

Element object after animation.

required
vector RegUnit

Register object.

required
index int

Index of element.

required
reg_idx int

register index.

required
offset int

Offset of lowest bit.

required

Returns:

Type Description
Animation

Animation to assign an element to a register.

decl_register(*registers)

Declare registers. Fadein a list of register objects.

Parameters:

Name Type Description Default
registers List[Union[RegUnit]]

List of registers.

()

Returns:

Type Description
Animation

Animation to declare registers.

read_elem(vector, elem, index, reg_idx, offset)

Read specified element from one register. Fade in element at the specified position related to the register.

Parameters:

Name Type Description Default
vector RegUnit

Object of the register.

required
elem ElemUnit

Object of the element.

required
index int

Element index.

required
reg_idx int

Register index. Used only for two-dimension register units.

required
offset int

Offset of lowest bit.

required

Returns:

Type Description
Animation

Animation to read an element from a register.

replace_elem(old_elem, new_elem, offset)

Replace exist element with a new element. The new element is right-aligned with the existed element. offset specifies the gap between the LSB of two registers, which can be positive or negative.

Parameters:

Name Type Description Default
old_elem ElemUnit

Object of the old element.

required
new_elem ElemUnit

Object of the new element.

required
offset int

Offset of lower bits.

required

Returns:

Type Description
Animation

Animation to declare registers.

replace_register(old_reg, new_reg, offset)

Replacing exist register with a new register. The new register is right-aligned with the old register. offset specifies the gap between the LSB of two registers, which can be positive or negative.

Parameters:

Name Type Description Default
old_reg RegUnit

Object of the old vector.

required
new_reg RegUnit

Object of the new vector.

required
offset int

Offset of lower bits.

required

Returns:

Type Description
Animation

Animation to replace registers.