EffectCharacter
Module: terminaltexteffects.engine.base_character
Bases: SpatialNode
A class representing a single character from the input data.
EffectCharacters are created and managed by the Terminal and are used to apply
animations and effects to individual characters. Additional non-input characters
can be created with Terminal.add_character().
Methods:
| Name | Description |
|---|---|
tick |
Progress the character's animation and motion by one step. |
Attributes:
| Name | Type | Description |
|---|---|---|
character_id |
int
|
The unique ID of the character, generated by the Terminal. |
input_symbol |
str
|
The symbol for the character in the input data. |
input_coord |
Coord
|
The coordinate of the character in the input data. |
is_visible |
bool
|
Whether the character is currently visible and should be printed to the terminal. |
animation |
Animation
|
The animation object that controls the character's appearance. |
motion |
Motion
|
The motion object that controls the character's movement. |
parent |
Body
|
The body the character's position is measured against: the terminal's text plane until it's moved elsewhere. |
position |
Vec3
|
The character's position in its parent's frame, |
world_position |
Vec3
|
The character's position in the world. |
view |
View
|
How the character is seen this frame: its cell, depth, facing and light. |
event_handler |
EventHandler
|
The event handler object that handles events related to the character. |
layer |
int
|
The layer of the character. Lower layers are painted first. Within a layer, characters are
ordered by their depth from the camera, farther first. When characters on the same layer and at the same
depth collide, the character with the higher |
is_fill_character |
bool
|
Whether the character is a fill character. Fill characters are used to fill the empty cells of the Canvas. |
uses_input_preexisting_colors |
bool
|
Whether engine-level |
links |
set[EffectCharacter]
|
Linked neighboring characters used by spanning-tree algorithms. |
neighbors |
dict[str, EffectCharacter | None]
|
Adjacent characters keyed by direction
( |
Source code in terminaltexteffects/engine/base_character.py
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | |
character_id
property
The unique ID of the character, generated by the Terminal.
input_coord
property
The coordinate of the character in the input data.
input_symbol
property
The symbol for the character in the input data.
is_active
property
Returns whether the character is currently active.
A character is active when its animation has an incomplete active scene or its motion has an incomplete active path.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the character is active, False if not. |
is_visible
property
Whether the character is currently visible and should be printed to the terminal.
layer
property
writable
Rendering layer used to resolve character collisions.
neighbors
property
Adjacent characters keyed by cardinal direction.
Terminal-owned characters prepare their terminal's complete character graph on first access. Standalone characters receive an independent empty mapping.
position
property
The character's position in its parent's frame: (column, row, height) on the text plane.
view
property
How the character is seen from the camera: its cell, depth, facing, light and face.
__hash__()
Hash by character_id, so sets of characters iterate in the same order on every run.
Equality stays identity. Hashing by memory address made the order of active_characters vary between runs,
and with it the order effects drew random numbers, so --seed didn't reproduce some effects.
Source code in terminaltexteffects/engine/base_character.py
__init__(character_id, symbol, input_column, input_row)
Initialize the character instance with the character ID, symbol, and input coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
character_id
|
int
|
The unique ID of the character, generated by the Terminal. |
required |
symbol
|
str
|
The symbol for the character in the input data. |
required |
input_column
|
int
|
The column of the character in the input data. |
required |
input_row
|
int
|
The row of the character in the input data. |
required |
Source code in terminaltexteffects/engine/base_character.py
__repr__()
Return a string representation of the EffectCharacter instance.
Source code in terminaltexteffects/engine/base_character.py
tick()
Progress the character by one tick.
Motion is advanced first, then animation is stepped so animation logic can react to the character's updated motion state for the same tick.