EffectCharacter
Module: terminaltexteffects.engine.base_character
A class representing a single character from the input data.
EffectCharacters are managed by the Terminal and are used to apply animations and effects to individual characters. Add an EffectCharacter to the Terminal using the add_character method of the Terminal class.
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. |
Source code in terminaltexteffects/engine/base_character.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 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 | |
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 if its animation or motion is not complete.
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.