Beams
Quick Start
from terminaltexteffects.effects.effect_beams import Beams
effect = Beams("YourTextHere")
with effect.terminal_output() as terminal:
for frame in effect:
terminal.print(frame)
Creates beams which travel over the canvas illuminating the characters.
Classes:
Name | Description |
---|---|
Beams |
Creates beams which travel over the canvas illuminating the characters. |
BeamsConfig |
Configuration for the Beams effect. |
BeamsIterator |
Iterates over the Beams effect. Does not normally need to be called directly. |
Beams
Bases: BaseEffect[BeamsConfig]
Creates beams which travel over the canvas illuminating the characters.
Attributes:
Name | Type | Description |
---|---|---|
effect_config |
BeamsConfig
|
Configuration for the effect. |
terminal_config |
TerminalConfig
|
Configuration for the terminal. |
Source code in terminaltexteffects/effects/effect_beams.py
BeamsConfig
dataclass
Bases: ArgsDataClass
Configuration for the Beams effect.
Attributes:
Name | Type | Description |
---|---|---|
beam_row_symbols |
tuple[str, ...] | str
|
Symbols to use for the beam effect when moving along a row. Strings will be used in sequence to create an animation. |
beam_column_symbols |
tuple[str, ...] | str
|
Symbols to use for the beam effect when moving along a column. Strings will be used in sequence to create an animation. |
beam_delay |
int
|
Number of frames to wait before adding the next group of beams. Beams are added in groups of size random(1, 5). Valid values are n > 0. |
beam_row_speed_range |
tuple[int, int]
|
Speed range of the beam when moving along a row. Valid values are n > 0. |
beam_column_speed_range |
tuple[int, int]
|
Speed range of the beam when moving along a column. Valid values are n > 0. |
beam_gradient_stops |
tuple[Color, ...]
|
Tuple of colors for the beam, a gradient will be created between the colors. |
beam_gradient_steps |
tuple[int, ...] | int
|
Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Steps are paired with the colors in final-gradient-stops. Valid values are n > 0. |
beam_gradient_frames |
int
|
Number of frames to display each gradient step. Increase to slow down the gradient animation. Valid values are n > 0. |
final_gradient_stops |
tuple[Color, ...]
|
Tuple of colors for the wipe gradient. |
final_gradient_steps |
tuple[int, ...] | int
|
Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Steps are paired with the colors in final-gradient-stops. Valid values are n > 0. |
final_gradient_frames |
int
|
Number of frames to display each gradient step. Increase to slow down the gradient animation. |
final_gradient_direction |
Direction
|
Direction of the final gradient. |
final_wipe_speed |
int
|
Speed of the final wipe as measured in diagonal groups activated per frame. Valid values are n > 0. |
Source code in terminaltexteffects/effects/effect_beams.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
|
beam_column_speed_range = ArgField(cmd_name='--beam-column-speed-range', type_parser=argvalidators.PositiveIntRange.type_parser, default=(6, 10), metavar=argvalidators.PositiveIntRange.METAVAR, help='Speed range of the beam when moving along a column.')
class-attribute
instance-attribute
tuple[int, int] : Speed range of the beam when moving along a column.
beam_column_symbols = ArgField(cmd_name='--beam-column-symbols', type_parser=argvalidators.Symbol.type_parser, nargs='+', default=('▌', '▍', '▎', '▏'), metavar=argvalidators.Symbol.METAVAR, help='Symbols to use for the beam effect when moving along a column. Strings will be used in sequence to create an animation.')
class-attribute
instance-attribute
tuple[str, ...] | str : Symbols to use for the beam effect when moving along a column. Strings will be used in sequence to create an animation.
beam_delay = ArgField(cmd_name='--beam-delay', type_parser=argvalidators.PositiveInt.type_parser, default=10, metavar=argvalidators.PositiveInt.METAVAR, help='Number of frames to wait before adding the next group of beams. Beams are added in groups of size random(1, 5).')
class-attribute
instance-attribute
int : Number of frames to wait before adding the next group of beams. Beams are added in groups of size random(1, 5).
beam_gradient_frames = ArgField(cmd_name='--beam-gradient-frames', type_parser=argvalidators.PositiveInt.type_parser, default=2, metavar=argvalidators.PositiveInt.METAVAR, help='Number of frames to display each gradient step. Increase to slow down the gradient animation.')
class-attribute
instance-attribute
int : Number of frames to display each gradient step. Increase to slow down the gradient animation.
beam_gradient_steps = ArgField(cmd_name='--beam-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(2, 8), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, numbers for the of gradient steps to use. More steps will create a smoother and longer gradient animation. Steps are paired with the colors in final-gradient-stops.')
class-attribute
instance-attribute
tuple[int, ...] | int : Int or Tuple of ints for the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Steps are paired with the colors in final-gradient-stops.
beam_gradient_stops = ArgField(cmd_name='--beam-gradient-stops', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=(tte.Color('ffffff'), tte.Color('00D1FF'), tte.Color('8A008A')), metavar='(XTerm [0-255] OR RGB Hex [000000-ffffff])', help='Space separated, unquoted, list of colors for the beam, a gradient will be created between the colors.')
class-attribute
instance-attribute
tuple[tte.Color, ...] : Tuple of colors for the beam, a gradient will be created between the colors.
beam_row_speed_range = ArgField(cmd_name='--beam-row-speed-range', type_parser=argvalidators.PositiveIntRange.type_parser, default=(10, 40), metavar=argvalidators.PositiveIntRange.METAVAR, help='Speed range of the beam when moving along a row.')
class-attribute
instance-attribute
tuple[int, int] : Speed range of the beam when moving along a row.
beam_row_symbols = ArgField(cmd_name='--beam-row-symbols', type_parser=argvalidators.Symbol.type_parser, nargs='+', default=('▂', '▁', '_'), metavar=argvalidators.Symbol.METAVAR, help='Symbols to use for the beam effect when moving along a row. Strings will be used in sequence to create an animation.')
class-attribute
instance-attribute
tuple[str, ...] | str : Symbols to use for the beam effect when moving along a row. Strings will be used in sequence to create an animation.
final_gradient_direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=tte.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.')
class-attribute
instance-attribute
tte.Gradient.Direction : Direction of the final gradient.
final_gradient_frames = ArgField(cmd_name='--final-gradient-frames', type_parser=argvalidators.PositiveInt.type_parser, default=5, metavar=argvalidators.PositiveInt.METAVAR, help='Number of frames to display each gradient step. Increase to slow down the gradient animation.')
class-attribute
instance-attribute
int : Number of frames to display each gradient step. Increase to slow down the gradient animation.
final_gradient_steps = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=12, metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, numbers for the of gradient steps to use. More steps will create a smoother and longer gradient animation. Steps are paired with the colors in final-gradient-stops.')
class-attribute
instance-attribute
tuple[int, ...] | int : Int or Tuple of ints for the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Steps are paired with the colors in final-gradient-stops.
final_gradient_stops = ArgField(cmd_name='--final-gradient-stops', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=(tte.Color('8A008A'), tte.Color('00D1FF'), tte.Color('ffffff')), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the wipe gradient.')
class-attribute
instance-attribute
tuple[tte.Color, ...] : Tuple of colors for the wipe gradient.
final_wipe_speed = ArgField(cmd_name='--final-wipe-speed', type_parser=argvalidators.PositiveInt.type_parser, default=1, metavar=argvalidators.PositiveInt.METAVAR, help='Speed of the final wipe as measured in diagonal groups activated per frame.')
class-attribute
instance-attribute
int : Speed of the final wipe as measured in diagonal groups activated per frame.
BeamsIterator
Bases: BaseEffectIterator[BeamsConfig]
Iterator for the Beams effect.
Source code in terminaltexteffects/effects/effect_beams.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 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 |
|
Group
Represents a group of characters.
Source code in terminaltexteffects/effects/effect_beams.py
__init__(characters, direction, terminal, args)
Initialize the Group.
Source code in terminaltexteffects/effects/effect_beams.py
complete()
Check if the group is complete.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the group is complete, False otherwise. |
get_next_character()
Get the next character in the group.
If the next character is already active, determined by having an active scene, the active scene is reset and None is returned. Otherwise, the next character is returned and the character is made visible.
Returns:
Type | Description |
---|---|
EffectCharacter | None
|
tte.EffectCharacter | None: The next character if the character or None if the character is already active. |
Source code in terminaltexteffects/effects/effect_beams.py
__init__(effect)
Initialize the BeamsIterator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
effect
|
Beams
|
The Beams effect instance. |
required |
Source code in terminaltexteffects/effects/effect_beams.py
__next__()
Return the next frame in the effect.
Source code in terminaltexteffects/effects/effect_beams.py
build()
Build the initial state for the Beams effect.
Source code in terminaltexteffects/effects/effect_beams.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 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 |
|