Sweep

Quick Start
import terminaltexteffects as tte
from terminaltexteffects.effects.effect_sweep import Sweep
effect = Sweep("YourTextHere")
effect.effect_config.final_gradient_direction = tte.Gradient.Direction.HORIZONTAL
with effect.terminal_output() as terminal:
for frame in effect:
terminal.print(frame)
Sweep Directions and Sorts
New in 0.16.0
CharacterOrder directions, --travel-speed, and the reverse-direction options are available on
development main and are not in the published 0.15.0 package.
--first-sweep-direction and --second-sweep-direction each accept every CharacterOrder. The first sweep reveals the text with a gray shimmer; the second colors it.
You can choose a group direction for one phase and a sort for the other, or use separate sorts
for both phases. The defaults remain column_right_to_left and column_left_to_right.
Group directions activate whole spatial bands. Sort directions activate individual characters in
the exact order returned by Terminal.get_characters(). Both phases include inner and outer fill
characters, so spiral sorts cover the canvas bounds, including blank space around the input.
See Spiral Sorting for the six spiral orders, their starting corners, and how multiple arms interleave.
Both grouped and sorted modes retain the same easing schedule; several characters may activate in one frame. Each phase starts its own sequence, and the final frame restores input symbols and clears the fill characters.
Travel Speed
--travel-speed advances both sweep phases by the specified number of easing steps per frame.
It accepts a positive integer and defaults to 1, preserving the original pacing. Higher values
activate more characters or complete spatial groups per frame while retaining the easing curve,
selected order, and reversal. The exact activation count varies along the easing curve.
Each phase retains its 100-step schedule, so speed 4 finishes scheduling a phase in 25 frames.
The second phase starts on the following frame, and active character animations still advance
once per frame and finish normally. This differs from Waves, where travel speed counts ordered
entries rather than easing steps.
tte sweep --first-sweep-direction spiral_clockwise --second-sweep-direction spiral_counter_clockwise
tte sweep --first-sweep-direction spiral_clockwise --second-sweep-direction spiral_counter_clockwise --travel-speed 8
tte sweep --first-sweep-direction column_right_to_left --second-sweep-direction spiral_clockwise_quad
Use --reverse-first-sweep-direction and --reverse-second-sweep-direction to reverse each
phase independently. Group membership is preserved, and both flags default to off.
tte sweep --first-sweep-direction spiral_clockwise --reverse-first-sweep-direction \
--second-sweep-direction circle_center_to_outside --reverse-second-sweep-direction
Configurations normalize to CharacterOrder. Existing CharacterGroup and CharacterSort
values and their CLI spellings remain accepted as compatibility inputs.
For library use, assign native enums or their CLI spellings:
from terminaltexteffects.effects.effect_sweep import Sweep
from terminaltexteffects import CharacterOrder
effect = Sweep("YourTextHere")
effect.effect_config.first_sweep_direction = CharacterOrder.COLUMN_RIGHT_TO_LEFT
effect.effect_config.second_sweep_direction = CharacterOrder.SPIRAL_CLOCKWISE_DOUBLE
effect.effect_config.travel_speed = 8
Sweep across the canvas to reveal uncolored text, reverse sweep to color the text.
Classes:
| Name | Description |
|---|---|
Sweep |
Sweep across the canvas to reveal uncolored text, reverse sweep to color the text. |
SweepConfig |
Configuration for the Sweep effect. |
SweepIterator |
Iterator for the Sweep effect. |
Sweep
Bases: BaseEffect[SweepConfig]
Sweep across the canvas to reveal uncolored text, reverse sweep to color the text.
Source code in terminaltexteffects/effects/effect_sweep.py
SweepConfig
dataclass
Bases: BaseConfig
Sweep effect configuration dataclass.
Source code in terminaltexteffects/effects/effect_sweep.py
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 | |
final_gradient_direction = FinalGradientDirectionArg(default=tte.Gradient.Direction.VERTICAL)
class-attribute
instance-attribute
Gradient.Direction : Direction of the final gradient.
final_gradient_steps = FinalGradientStepsArg(default=8)
class-attribute
instance-attribute
tuple[int, ...] | int: Space separated, unquoted, list of the number of gradient steps to use. More steps will
final_gradient_stops = FinalGradientStopsArg(default=(tte.Color('#8A008A'), tte.Color('#00D1FF'), tte.Color('#ffffff')), help='Space separated, unquoted, list of colors for the character gradient (applied from bottom to top). If only one color is provided, the characters will be displayed in that color.')
class-attribute
instance-attribute
tuple[Color, ...]: Space separated, unquoted, list of colors for the character gradient
first_sweep_direction = argutils.ArgSpec(name='--first-sweep-direction', default=argutils.CharacterOrder.COLUMN_RIGHT_TO_LEFT, type=argutils.CharacterOrderArg.type_parser, metavar=' '.join(argutils.CharacterOrderArg.METAVAR), help='Grouping or character sort order for the first sweep, revealing uncolored characters.')
class-attribute
instance-attribute
CharacterOrder : Order of the first sweep, revealing uncolored characters.
reverse_first_sweep_direction = argutils.ArgSpec(name='--reverse-first-sweep-direction', default=False, action='store_true', help='Reverse the complete first sweep direction traversal.')
class-attribute
instance-attribute
bool : Reverse the complete traversal, preserving group membership.
reverse_second_sweep_direction = argutils.ArgSpec(name='--reverse-second-sweep-direction', default=False, action='store_true', help='Reverse the complete second sweep direction traversal.')
class-attribute
instance-attribute
bool : Reverse the complete traversal, preserving group membership.
second_sweep_direction = argutils.ArgSpec(name='--second-sweep-direction', default=argutils.CharacterOrder.COLUMN_LEFT_TO_RIGHT, type=argutils.CharacterOrderArg.type_parser, metavar=' '.join(argutils.CharacterOrderArg.METAVAR), help='Grouping or character sort order for the second sweep, coloring the characters.')
class-attribute
instance-attribute
CharacterOrder : Order of the second sweep, coloring the characters.
sweep_symbols = argutils.ArgSpec(name='--sweep-symbols', type=argutils.Symbol.type_parser, nargs='+', action=argutils.TupleAction, default=('â–ˆ', 'â–“', 'â–’', 'â–‘'), metavar=argutils.Symbol.METAVAR, help='Space separated list of symbols to use for the sweep shimmer.')
class-attribute
instance-attribute
tuple[str, ...] | str : Tuple of symbols to use for the sweep shimmer.
travel_speed = argutils.ArgSpec(name='--travel-speed', type=argutils.PositiveInt.type_parser, default=1, metavar=argutils.PositiveInt.METAVAR, help='Number of sweep easing steps to advance per frame, for both phases. n > 0.')
class-attribute
instance-attribute
int : Easing steps per frame for both sweeps; animations advance once per frame. Defaults to 1.
SweepIterator
Bases: BaseEffectIterator[SweepConfig]
Iterator for the sweep effect.
Source code in terminaltexteffects/effects/effect_sweep.py
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 245 246 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 | |
__init__(effect)
Initialize the effect iterator.
Source code in terminaltexteffects/effects/effect_sweep.py
__next__()
Return the next frame in the effect.
Source code in terminaltexteffects/effects/effect_sweep.py
build()
Build the effect.
Source code in terminaltexteffects/effects/effect_sweep.py
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 | |
get_effect_resources()
Get the command, effect class, and configuration class for the effect.
Returns:
| Type | Description |
|---|---|
tuple[str, type[BaseEffect], type[BaseConfig]]
|
tuple[str, type[BaseEffect], type[BaseConfig]]: The command name, effect class, and configuration class. |