EffectCharacter
Module: terminaltexteffects.engine.base_character
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. |
event_handler |
EventHandler
|
The event handler object that handles events related to the character. |
layer |
int
|
The layer of the character. The layer determines the order in which characters are printed. |
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
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | |
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.
__eq__(other)
Check if two EffectCharacter instances are equal based on their character_id.
Source code in terminaltexteffects/engine/base_character.py
__hash__()
__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.