diff --git a/404.html b/404.html index f441987a..7d0ac0ec 100755 --- a/404.html +++ b/404.html @@ -228,6 +228,41 @@ + + + diff --git a/effects/beams/index.html b/effects/beams/index.html index 211222c4..9b2c5bd7 100755 --- a/effects/beams/index.html +++ b/effects/beams/index.html @@ -9,7 +9,7 @@ - + @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1507,7 +2124,7 @@

    - Bases: BaseEffect[BeamsConfig]

    + Bases: BaseEffect[BeamsConfig]

    Creates beams which travel over the output area illuminating the characters.

    @@ -1689,7 +2306,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Beams effect.

    @@ -1830,7 +2447,7 @@

    final_gradient_direction - Direction + Direction
    @@ -2046,10 +2663,10 @@

    beam_row_symbols: tuple[str, ...] = ArgField( cmd_name="--beam-row-symbols", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, nargs="+", default=("▂", "▁", "_"), - metavar=arg_validators.Symbol.METAVAR, + 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.", ) # type: ignore[assignment] @@ -2057,10 +2674,10 @@

    beam_column_symbols: tuple[str, ...] = ArgField( cmd_name="--beam-column-symbols", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, nargs="+", default=("▌", "▍", "▎", "▏"), - metavar=arg_validators.Symbol.METAVAR, + 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.", ) # type: ignore[assignment] @@ -2068,9 +2685,9 @@

    beam_delay: int = ArgField( cmd_name="--beam-delay", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=10, - metavar=arg_validators.PositiveInt.METAVAR, + 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).", ) # type: ignore[assignment] @@ -2078,9 +2695,9 @@

    beam_row_speed_range: tuple[int, int] = ArgField( cmd_name="--beam-row-speed-range", - type_parser=arg_validators.IntRange.type_parser, + type_parser=argvalidators.IntRange.type_parser, default=(10, 40), - metavar=arg_validators.IntRange.METAVAR, + metavar=argvalidators.IntRange.METAVAR, help="Speed range of the beam when moving along a row.", ) # type: ignore[assignment] @@ -2088,9 +2705,9 @@

    beam_column_speed_range: tuple[int, int] = ArgField( cmd_name="--beam-column-speed-range", - type_parser=arg_validators.IntRange.type_parser, + type_parser=argvalidators.IntRange.type_parser, default=(6, 10), - metavar=arg_validators.IntRange.METAVAR, + metavar=argvalidators.IntRange.METAVAR, help="Speed range of the beam when moving along a column.", ) # type: ignore[assignment] @@ -2098,7 +2715,7 @@

    beam_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name="--beam-gradient-stops", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("ffffff", "00D1FF", "8A008A"), metavar="(XTerm [0-255] OR RGB Hex [000000-ffffff])", @@ -2109,10 +2726,10 @@

    beam_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--beam-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(2, 8), - metavar=arg_validators.PositiveInt.METAVAR, + 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.", ) # type: ignore[assignment] @@ -2120,9 +2737,9 @@

    beam_gradient_frames: int = ArgField( cmd_name="--beam-gradient-frames", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=2, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of frames to display each gradient step.", ) # type: ignore[assignment] @@ -2130,10 +2747,10 @@

    final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name="--final-gradient-stops", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("8A008A", "00D1FF", "ffffff"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Space separated, unquoted, list of colors for the wipe gradient.", ) # type: ignore[assignment] @@ -2141,10 +2758,10 @@

    final_gradient_steps: tuple[int,] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + 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.", ) # type: ignore[assignment] @@ -2152,9 +2769,9 @@

    final_gradient_frames: int = ArgField( cmd_name="--final-gradient-frames", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=5, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of frames to display each gradient step.", ) # type: ignore[assignment] @@ -2162,9 +2779,9 @@

    final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] @@ -2172,9 +2789,9 @@

    final_wipe_speed: int = ArgField( cmd_name="--final-wipe-speed", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=1, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Speed of the final wipe as measured in diagonal groups activated per frame.", ) # type: ignore[assignment] @@ -2201,7 +2818,7 @@

    - beam_column_speed_range: tuple[int, int] = ArgField(cmd_name='--beam-column-speed-range', type_parser=arg_validators.IntRange.type_parser, default=(6, 10), metavar=arg_validators.IntRange.METAVAR, help='Speed range of the beam when moving along a column.') + beam_column_speed_range: tuple[int, int] = ArgField(cmd_name='--beam-column-speed-range', type_parser=argvalidators.IntRange.type_parser, default=(6, 10), metavar=argvalidators.IntRange.METAVAR, help='Speed range of the beam when moving along a column.') class-attribute @@ -2223,7 +2840,7 @@

    - beam_column_symbols: tuple[str, ...] = ArgField(cmd_name='--beam-column-symbols', type_parser=arg_validators.Symbol.type_parser, nargs='+', default=('▌', '▍', '▎', '▏'), metavar=arg_validators.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.') + beam_column_symbols: tuple[str, ...] = 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 @@ -2245,7 +2862,7 @@

    - beam_delay: int = ArgField(cmd_name='--beam-delay', type_parser=arg_validators.PositiveInt.type_parser, default=10, metavar=arg_validators.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).') + beam_delay: int = 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 @@ -2267,7 +2884,7 @@

    - beam_gradient_frames: int = ArgField(cmd_name='--beam-gradient-frames', type_parser=arg_validators.PositiveInt.type_parser, default=2, metavar=arg_validators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') + beam_gradient_frames: int = 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.') class-attribute @@ -2289,7 +2906,7 @@

    - beam_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--beam-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(2, 8), metavar=arg_validators.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.') + beam_gradient_steps: tuple[int, ...] = 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 @@ -2311,7 +2928,7 @@

    - beam_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--beam-gradient-stops', type_parser=arg_validators.Color.type_parser, nargs='+', default=('ffffff', '00D1FF', '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.') + beam_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--beam-gradient-stops', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('ffffff', '00D1FF', '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 @@ -2333,7 +2950,7 @@

    - beam_row_speed_range: tuple[int, int] = ArgField(cmd_name='--beam-row-speed-range', type_parser=arg_validators.IntRange.type_parser, default=(10, 40), metavar=arg_validators.IntRange.METAVAR, help='Speed range of the beam when moving along a row.') + beam_row_speed_range: tuple[int, int] = ArgField(cmd_name='--beam-row-speed-range', type_parser=argvalidators.IntRange.type_parser, default=(10, 40), metavar=argvalidators.IntRange.METAVAR, help='Speed range of the beam when moving along a row.') class-attribute @@ -2355,7 +2972,7 @@

    - beam_row_symbols: tuple[str, ...] = ArgField(cmd_name='--beam-row-symbols', type_parser=arg_validators.Symbol.type_parser, nargs='+', default=('▂', '▁', '_'), metavar=arg_validators.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.') + beam_row_symbols: tuple[str, ...] = 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 @@ -2377,7 +2994,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -2399,7 +3016,7 @@

    - final_gradient_frames: int = ArgField(cmd_name='--final-gradient-frames', type_parser=arg_validators.PositiveInt.type_parser, default=5, metavar=arg_validators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') + final_gradient_frames: int = 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.') class-attribute @@ -2421,7 +3038,7 @@

    - final_gradient_steps: tuple[int] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.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.') + final_gradient_steps: tuple[int] = 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 @@ -2443,7 +3060,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'ffffff'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the wipe gradient.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'ffffff'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the wipe gradient.') class-attribute @@ -2465,7 +3082,7 @@

    - final_wipe_speed: int = ArgField(cmd_name='--final-wipe-speed', type_parser=arg_validators.PositiveInt.type_parser, default=1, metavar=arg_validators.PositiveInt.METAVAR, help='Speed of the final wipe as measured in diagonal groups activated per frame.') + final_wipe_speed: int = 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 diff --git a/effects/binarypath/index.html b/effects/binarypath/index.html index 8dbd6902..f810f16e 100755 --- a/effects/binarypath/index.html +++ b/effects/binarypath/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1381,7 +1998,7 @@

    - Bases: BaseEffect

    + Bases: BaseEffect

    Decodes characters into their binary form. Characters travel from outside the output area towards their input coordinate, moving at right angles.

    @@ -1567,7 +2184,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the BinaryPath effect.

    @@ -1609,7 +2226,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1758,10 +2375,10 @@

    final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("00d500", "007500"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] @@ -1769,10 +2386,10 @@

    final_gradient_steps: tuple[int, ...] = ArgField( cmd_name=["--final-gradient-steps"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] @@ -1780,9 +2397,9 @@

    final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.CENTER, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] @@ -1790,10 +2407,10 @@

    binary_colors: tuple[graphics.Color, ...] = ArgField( cmd_name=["--binary-colors"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("044E29", "157e38", "45bf55", "95ed87"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Space separated, unquoted, list of colors for the binary characters. Character color is randomly assigned from this list.", ) # type: ignore[assignment] @@ -1801,9 +2418,9 @@

    movement_speed: float = ArgField( cmd_name="--movement-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=1.0, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Speed of the binary groups as they travel around the terminal.", ) # type: ignore[assignment] @@ -1811,9 +2428,9 @@

    active_binary_groups: float = ArgField( cmd_name="--active-binary-groups", - type_parser=arg_validators.Ratio.type_parser, + type_parser=argvalidators.Ratio.type_parser, default=0.05, - metavar=arg_validators.Ratio.METAVAR, + metavar=argvalidators.Ratio.METAVAR, help="Maximum number of binary groups that are active at any given time as a percentage of the total number of binary groups. Lower this to improve performance.", ) # type: ignore[assignment] @@ -1840,7 +2457,7 @@

    - active_binary_groups: float = ArgField(cmd_name='--active-binary-groups', type_parser=arg_validators.Ratio.type_parser, default=0.05, metavar=arg_validators.Ratio.METAVAR, help='Maximum number of binary groups that are active at any given time as a percentage of the total number of binary groups. Lower this to improve performance.') + active_binary_groups: float = ArgField(cmd_name='--active-binary-groups', type_parser=argvalidators.Ratio.type_parser, default=0.05, metavar=argvalidators.Ratio.METAVAR, help='Maximum number of binary groups that are active at any given time as a percentage of the total number of binary groups. Lower this to improve performance.') class-attribute @@ -1862,7 +2479,7 @@

    - binary_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--binary-colors'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('044E29', '157e38', '45bf55', '95ed87'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the binary characters. Character color is randomly assigned from this list.') + binary_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--binary-colors'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('044E29', '157e38', '45bf55', '95ed87'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the binary characters. Character color is randomly assigned from this list.') class-attribute @@ -1884,7 +2501,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.CENTER, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.CENTER, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1906,7 +2523,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1928,7 +2545,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('00d500', '007500'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('00d500', '007500'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -1950,7 +2567,7 @@

    - movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=1.0, metavar=arg_validators.PositiveFloat.METAVAR, help='Speed of the binary groups as they travel around the terminal.') + movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=1.0, metavar=argvalidators.PositiveFloat.METAVAR, help='Speed of the binary groups as they travel around the terminal.') class-attribute diff --git a/effects/blackhole/index.html b/effects/blackhole/index.html index 15c76cb6..d2e7e303 100755 --- a/effects/blackhole/index.html +++ b/effects/blackhole/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1363,7 +1980,7 @@

    - Bases: BaseEffect[BlackholeConfig]

    + Bases: BaseEffect[BlackholeConfig]

    Creates a blackhole in a starfield, consumes the stars, explodes the input data back into position.

    @@ -1407,8 +2024,7 @@

    Source code in terminaltexteffects/effects/effect_blackhole.py -
    374
    -375
    +              
    375
     376
     377
     378
    @@ -1424,24 +2040,25 @@ 

    388 389 390 -391

    class Blackhole(BaseEffect[BlackholeConfig]):
    -    """Creates a blackhole in a starfield, consumes the stars, explodes the input data back into position.
    -
    -    Attributes:
    -        effect_config (BlackholeConfig): Configuration for the Blackhole effect.
    -        terminal_config (TerminalConfig): Configuration for the terminal.
    -    """
    -
    -    _config_cls = BlackholeConfig
    -    _iterator_cls = BlackholeIterator
    -
    -    def __init__(self, input_data: str) -> None:
    -        """Initializes the Blackhole effect with the provided input data.
    -
    -        Args:
    -            input_data (str): The input data to use for the Blackhole effect.
    -        """
    -        super().__init__(input_data)
    +391
    +392
    class Blackhole(BaseEffect[BlackholeConfig]):
    +    """Creates a blackhole in a starfield, consumes the stars, explodes the input data back into position.
    +
    +    Attributes:
    +        effect_config (BlackholeConfig): Configuration for the Blackhole effect.
    +        terminal_config (TerminalConfig): Configuration for the terminal.
    +    """
    +
    +    _config_cls = BlackholeConfig
    +    _iterator_cls = BlackholeIterator
    +
    +    def __init__(self, input_data: str) -> None:
    +        """Initializes the Blackhole effect with the provided input data.
    +
    +        Args:
    +            input_data (str): The input data to use for the Blackhole effect.
    +        """
    +        super().__init__(input_data)
     
    @@ -1504,19 +2121,19 @@

    Source code in terminaltexteffects/effects/effect_blackhole.py -
    385
    -386
    +            
    def __init__(self, input_data: str) -> None:
    -    """Initializes the Blackhole effect with the provided input data.
    -
    -    Args:
    -        input_data (str): The input data to use for the Blackhole effect.
    -    """
    -    super().__init__(input_data)
    +391
    +392
    def __init__(self, input_data: str) -> None:
    +    """Initializes the Blackhole effect with the provided input data.
    +
    +    Args:
    +        input_data (str): The input data to use for the Blackhole effect.
    +    """
    +    super().__init__(input_data)
     
    @@ -1549,7 +2166,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Blackhole effect.

    @@ -1613,7 +2230,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1626,151 +2243,151 @@

    Source code in terminaltexteffects/effects/effect_blackhole.py -
    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
    @argclass(
    -    name="blackhole",
    -    help="Characters are consumed by a black hole and explode outwards.",
    -    description="blackhole | Characters are consumed by a black hole and explode outwards.",
    -    epilog="""Example: terminaltexteffects blackhole --star-colors ffcc0d ff7326 ff194d bf2669 702a8c 049dbf --final-gradient-stops 8A008A 00D1FF FFFFFF --final-gradient-steps 12 --final-gradient-direction vertical""",
    -)
    -@dataclass
    -class BlackholeConfig(ArgsDataClass):
    -    """Configuration for the Blackhole effect.
    -
    -    Attributes:
    -        blackhole_color (graphics.Color): Color for the stars that comprise the blackhole border.
    -        star_colors (tuple[graphics.Color, ...]): Tuple of colors from which character colors will be chosen and applied after the explosion, but before the cooldown to final color.
    -        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the character gradient. If only one color is provided, the characters will be displayed in that color.
    -        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    -        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient."""
    -
    -    blackhole_color: graphics.Color = ArgField(
    -        cmd_name=["--blackhole-color"],
    -        type_parser=arg_validators.Color.type_parser,
    -        default="ffffff",
    -        metavar=arg_validators.Color.METAVAR,
    -        help="Color for the stars that comprise the blackhole border.",
    -    )  # type: ignore[assignment]
    -
    -    "graphics.Color : Color for the stars that comprise the blackhole border."
    -
    -    star_colors: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--star-colors"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("ffcc0d", "ff7326", "ff194d", "bf2669", "702a8c", "049dbf"),
    -        metavar=arg_validators.Color.METAVAR,
    -        help="List of colors from which character colors will be chosen and applied after the explosion, but before the cooldown to final color.",
    -    )  # type: ignore[assignment]
    -
    -    "tuple[graphics.Color, ...] : Tuple of colors from which character colors will be chosen and applied after the explosion, but before the cooldown to final color."
    -
    -    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--final-gradient-stops"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("8A008A", "00D1FF", "ffffff"),
    -        metavar=arg_validators.Color.METAVAR,
    -        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.",
    -    )  # type: ignore[assignment]
    -
    -    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    -
    -    final_gradient_steps: tuple[int, ...] = ArgField(
    -        cmd_name=["--final-gradient-steps"],
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        nargs="+",
    -        default=(12,),
    -        metavar=arg_validators.PositiveInt.METAVAR,
    -        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    -    )  # type: ignore[assignment]
    -
    -    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    -
    -    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    -        cmd_name="--final-gradient-direction",
    -        type_parser=arg_validators.GradientDirection.type_parser,
    -        default=graphics.Gradient.Direction.DIAGONAL,
    -        metavar=arg_validators.GradientDirection.METAVAR,
    -        help="Direction of the final gradient.",
    -    )  # type: ignore[assignment]
    -
    -    "graphics.Gradient.Direction : Direction of the final gradient."
    -
    -    @classmethod
    -    def get_effect_class(cls):
    -        return Blackhole
    +              
    @argclass(
    +    name="blackhole",
    +    help="Characters are consumed by a black hole and explode outwards.",
    +    description="blackhole | Characters are consumed by a black hole and explode outwards.",
    +    epilog="""Example: terminaltexteffects blackhole --star-colors ffcc0d ff7326 ff194d bf2669 702a8c 049dbf --final-gradient-stops 8A008A 00D1FF FFFFFF --final-gradient-steps 12 --final-gradient-direction vertical""",
    +)
    +@dataclass
    +class BlackholeConfig(ArgsDataClass):
    +    """Configuration for the Blackhole effect.
    +
    +    Attributes:
    +        blackhole_color (graphics.Color): Color for the stars that comprise the blackhole border.
    +        star_colors (tuple[graphics.Color, ...]): Tuple of colors from which character colors will be chosen and applied after the explosion, but before the cooldown to final color.
    +        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the character gradient. If only one color is provided, the characters will be displayed in that color.
    +        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    +        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient."""
    +
    +    blackhole_color: graphics.Color = ArgField(
    +        cmd_name=["--blackhole-color"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        default="ffffff",
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        help="Color for the stars that comprise the blackhole border.",
    +    )  # type: ignore[assignment]
    +
    +    "graphics.Color : Color for the stars that comprise the blackhole border."
    +
    +    star_colors: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--star-colors"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("ffcc0d", "ff7326", "ff194d", "bf2669", "702a8c", "049dbf"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        help="List of colors from which character colors will be chosen and applied after the explosion, but before the cooldown to final color.",
    +    )  # type: ignore[assignment]
    +
    +    "tuple[graphics.Color, ...] : Tuple of colors from which character colors will be chosen and applied after the explosion, but before the cooldown to final color."
    +
    +    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--final-gradient-stops"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("8A008A", "00D1FF", "ffffff"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        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.",
    +    )  # type: ignore[assignment]
    +
    +    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    +
    +    final_gradient_steps: tuple[int, ...] = ArgField(
    +        cmd_name=["--final-gradient-steps"],
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        nargs="+",
    +        default=(12,),
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    +    )  # type: ignore[assignment]
    +
    +    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    +
    +    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    +        cmd_name="--final-gradient-direction",
    +        type_parser=argvalidators.GradientDirection.type_parser,
    +        default=graphics.Gradient.Direction.DIAGONAL,
    +        metavar=argvalidators.GradientDirection.METAVAR,
    +        help="Direction of the final gradient.",
    +    )  # type: ignore[assignment]
    +
    +    "graphics.Gradient.Direction : Direction of the final gradient."
    +
    +    @classmethod
    +    def get_effect_class(cls):
    +        return Blackhole
     
    @@ -1789,7 +2406,7 @@

    - blackhole_color: graphics.Color = ArgField(cmd_name=['--blackhole-color'], type_parser=arg_validators.Color.type_parser, default='ffffff', metavar=arg_validators.Color.METAVAR, help='Color for the stars that comprise the blackhole border.') + blackhole_color: graphics.Color = ArgField(cmd_name=['--blackhole-color'], type_parser=argvalidators.ColorArg.type_parser, default='ffffff', metavar=argvalidators.ColorArg.METAVAR, help='Color for the stars that comprise the blackhole border.') class-attribute @@ -1811,7 +2428,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1833,7 +2450,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1855,7 +2472,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'ffffff'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'ffffff'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -1877,7 +2494,7 @@

    - star_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--star-colors'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('ffcc0d', 'ff7326', 'ff194d', 'bf2669', '702a8c', '049dbf'), metavar=arg_validators.Color.METAVAR, help='List of colors from which character colors will be chosen and applied after the explosion, but before the cooldown to final color.') + star_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--star-colors'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('ffcc0d', 'ff7326', 'ff194d', 'bf2669', '702a8c', '049dbf'), metavar=argvalidators.ColorArg.METAVAR, help='List of colors from which character colors will be chosen and applied after the explosion, but before the cooldown to final color.') class-attribute diff --git a/effects/bouncyballs/index.html b/effects/bouncyballs/index.html index 65a8a9e8..04a58766 100755 --- a/effects/bouncyballs/index.html +++ b/effects/bouncyballs/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1417,7 +2034,7 @@

    - Bases: BaseEffect[BouncyBallsConfig]

    + Bases: BaseEffect[BouncyBallsConfig]

    Characters fall from the top of the output area as bouncy balls before settling into place.

    @@ -1599,7 +2216,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the BouncyBalls effect.

    @@ -1663,7 +2280,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1810,7 +2427,7 @@

    name="bouncyballs", help="Characters are bouncy balls falling from the top of the output area.", description="bouncyballs | Characters are bouncy balls falling from the top of the output area.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects bouncyballs --ball-colors d1f4a5 96e2a4 5acda9 --ball-symbols o "*" O 0 . --final-gradient-stops f8ffae 43c6ac --final-gradient-steps 12 --final-gradient-direction diagonal --ball-delay 7 --movement-speed 0.25 --easing OUT_BOUNCE""", ) @dataclass @@ -1829,8 +2446,8 @@

    ball_colors: tuple[graphics.Color, ...] = ArgField( cmd_name=["--ball-colors"], - type_parser=arg_validators.Color.type_parser, - metavar=arg_validators.Color.METAVAR, + type_parser=argvalidators.ColorArg.type_parser, + metavar=argvalidators.ColorArg.METAVAR, nargs="+", default=("d1f4a5", "96e2a4", "5acda9"), help="Space separated list of colors from which ball colors will be randomly selected. If no colors are provided, the colors are random.", @@ -1839,63 +2456,63 @@

    ball_symbols: tuple[str, ...] = ArgField( cmd_name="--ball-symbols", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, nargs="+", default=("*", "o", "O", "0", "."), - metavar=arg_validators.Symbol.METAVAR, + metavar=argvalidators.Symbol.METAVAR, help="Space separated list of symbols to use for the balls.", ) # type: ignore[assignment] "tuple[str, ...] : Tuple of symbols to use for the balls." final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("f8ffae", "43c6ac"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name=["--final-gradient-steps"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." ball_delay: int = ArgField( cmd_name="--ball-delay", - type_parser=arg_validators.NonNegativeInt.type_parser, + type_parser=argvalidators.NonNegativeInt.type_parser, default=7, - metavar=arg_validators.NonNegativeInt.METAVAR, + metavar=argvalidators.NonNegativeInt.METAVAR, help="Number of frames between ball drops, increase to reduce ball drop rate.", ) # type: ignore[assignment] "int : Number of frames between ball drops, increase to reduce ball drop rate." movement_speed: float = ArgField( cmd_name="--movement-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.25, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Movement speed of the characters. ", ) # type: ignore[assignment] "float : Movement speed of the characters. " movement_easing: easing.EasingFunction = ArgField( cmd_name="--movement-easing", - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, default=easing.out_bounce, help="Easing function to use for character movement.", ) # type: ignore[assignment] @@ -1922,7 +2539,7 @@

    - ball_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--ball-colors'], type_parser=arg_validators.Color.type_parser, metavar=arg_validators.Color.METAVAR, nargs='+', default=('d1f4a5', '96e2a4', '5acda9'), help='Space separated list of colors from which ball colors will be randomly selected. If no colors are provided, the colors are random.') + ball_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--ball-colors'], type_parser=argvalidators.ColorArg.type_parser, metavar=argvalidators.ColorArg.METAVAR, nargs='+', default=('d1f4a5', '96e2a4', '5acda9'), help='Space separated list of colors from which ball colors will be randomly selected. If no colors are provided, the colors are random.') class-attribute @@ -1944,7 +2561,7 @@

    - ball_delay: int = ArgField(cmd_name='--ball-delay', type_parser=arg_validators.NonNegativeInt.type_parser, default=7, metavar=arg_validators.NonNegativeInt.METAVAR, help='Number of frames between ball drops, increase to reduce ball drop rate.') + ball_delay: int = ArgField(cmd_name='--ball-delay', type_parser=argvalidators.NonNegativeInt.type_parser, default=7, metavar=argvalidators.NonNegativeInt.METAVAR, help='Number of frames between ball drops, increase to reduce ball drop rate.') class-attribute @@ -1966,7 +2583,7 @@

    - ball_symbols: tuple[str, ...] = ArgField(cmd_name='--ball-symbols', type_parser=arg_validators.Symbol.type_parser, nargs='+', default=('*', 'o', 'O', '0', '.'), metavar=arg_validators.Symbol.METAVAR, help='Space separated list of symbols to use for the balls.') + ball_symbols: tuple[str, ...] = ArgField(cmd_name='--ball-symbols', type_parser=argvalidators.Symbol.type_parser, nargs='+', default=('*', 'o', 'O', '0', '.'), metavar=argvalidators.Symbol.METAVAR, help='Space separated list of symbols to use for the balls.') class-attribute @@ -1988,7 +2605,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -2010,7 +2627,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2032,7 +2649,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('f8ffae', '43c6ac'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('f8ffae', '43c6ac'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2054,7 +2671,7 @@

    - movement_easing: easing.EasingFunction = ArgField(cmd_name='--movement-easing', type_parser=arg_validators.Ease.type_parser, default=easing.out_bounce, help='Easing function to use for character movement.') + movement_easing: easing.EasingFunction = ArgField(cmd_name='--movement-easing', type_parser=argvalidators.Ease.type_parser, default=easing.out_bounce, help='Easing function to use for character movement.') class-attribute @@ -2076,7 +2693,7 @@

    - movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=0.25, metavar=arg_validators.PositiveFloat.METAVAR, help='Movement speed of the characters. ') + movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=0.25, metavar=argvalidators.PositiveFloat.METAVAR, help='Movement speed of the characters. ') class-attribute diff --git a/effects/bubbles/index.html b/effects/bubbles/index.html index e7cf5465..339672da 100755 --- a/effects/bubbles/index.html +++ b/effects/bubbles/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1453,7 +2070,7 @@

    - Bases: BaseEffect[BubblesConfig]

    + Bases: BaseEffect[BubblesConfig]

    Forms bubbles with the characters. Bubbles float down and pop.

    @@ -1635,7 +2252,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Bubbles effect.

    @@ -1710,7 +2327,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1889,7 +2506,7 @@

    name="bubbles", help="Characters are formed into bubbles that float down and pop.", description="bubbles | Characters are formed into bubbles that float down and pop.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects bubbles --bubble-colors d33aff 7395c4 43c2a7 02ff7f --pop-color ffffff --final-gradient-stops d33aff 02ff7f --final-gradient-steps 12 --final-gradient-direction diagonal --bubble-speed 0.1 --bubble-delay 50 --pop-condition row --easing IN_OUT_SINE""", ) @@ -1920,66 +2537,66 @@

    bubble_colors: tuple[graphics.Color, ...] = ArgField( cmd_name="--bubble-colors", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("d33aff", "7395c4", "43c2a7", "02ff7f"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Space separated, unquoted, list of colors for the bubbles. Ignored if --no-rainbow is left as default False.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the bubbles. Ignored if --no-rainbow is left as default False." pop_color: graphics.Color = ArgField( cmd_name="--pop-color", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, default="ffffff", - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Color for the spray emitted when a bubble pops.", ) # type: ignore[assignment] "graphics.Color : Color for the spray emitted when a bubble pops." final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("d33aff", "02ff7f"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." bubble_speed: float = ArgField( cmd_name="--bubble-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.1, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Speed of the floating bubbles. ", ) # type: ignore[assignment] "float : Speed of the floating bubbles. " bubble_delay: int = ArgField( cmd_name="--bubble-delay", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=50, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of frames between bubbles.", ) # type: ignore[assignment] "int : Number of frames between bubbles." @@ -1995,8 +2612,8 @@

    movement_easing: easing.EasingFunction = ArgField( cmd_name=["--movement-easing"], default=easing.in_out_sine, - type_parser=arg_validators.Ease.type_parser, - metavar=arg_validators.Ease.METAVAR, + type_parser=argvalidators.Ease.type_parser, + metavar=argvalidators.Ease.METAVAR, help="Easing function to use for character movement after a bubble pops.", ) # type: ignore[assignment] "easing.EasingFunction : Easing function to use for character movement after a bubble pops." @@ -2022,7 +2639,7 @@

    - bubble_colors: tuple[graphics.Color, ...] = ArgField(cmd_name='--bubble-colors', type_parser=arg_validators.Color.type_parser, nargs='+', default=('d33aff', '7395c4', '43c2a7', '02ff7f'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the bubbles. Ignored if --no-rainbow is left as default False.') + bubble_colors: tuple[graphics.Color, ...] = ArgField(cmd_name='--bubble-colors', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('d33aff', '7395c4', '43c2a7', '02ff7f'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the bubbles. Ignored if --no-rainbow is left as default False.') class-attribute @@ -2044,7 +2661,7 @@

    - bubble_delay: int = ArgField(cmd_name='--bubble-delay', type_parser=arg_validators.PositiveInt.type_parser, default=50, metavar=arg_validators.PositiveInt.METAVAR, help='Number of frames between bubbles.') + bubble_delay: int = ArgField(cmd_name='--bubble-delay', type_parser=argvalidators.PositiveInt.type_parser, default=50, metavar=argvalidators.PositiveInt.METAVAR, help='Number of frames between bubbles.') class-attribute @@ -2066,7 +2683,7 @@

    - bubble_speed: float = ArgField(cmd_name='--bubble-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=0.1, metavar=arg_validators.PositiveFloat.METAVAR, help='Speed of the floating bubbles. ') + bubble_speed: float = ArgField(cmd_name='--bubble-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=0.1, metavar=argvalidators.PositiveFloat.METAVAR, help='Speed of the floating bubbles. ') class-attribute @@ -2088,7 +2705,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -2110,7 +2727,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2132,7 +2749,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('d33aff', '02ff7f'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('d33aff', '02ff7f'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2154,7 +2771,7 @@

    - movement_easing: easing.EasingFunction = ArgField(cmd_name=['--movement-easing'], default=easing.in_out_sine, type_parser=arg_validators.Ease.type_parser, metavar=arg_validators.Ease.METAVAR, help='Easing function to use for character movement after a bubble pops.') + movement_easing: easing.EasingFunction = ArgField(cmd_name=['--movement-easing'], default=easing.in_out_sine, type_parser=argvalidators.Ease.type_parser, metavar=argvalidators.Ease.METAVAR, help='Easing function to use for character movement after a bubble pops.') class-attribute @@ -2176,7 +2793,7 @@

    - pop_color: graphics.Color = ArgField(cmd_name='--pop-color', type_parser=arg_validators.Color.type_parser, default='ffffff', metavar=arg_validators.Color.METAVAR, help='Color for the spray emitted when a bubble pops.') + pop_color: graphics.Color = ArgField(cmd_name='--pop-color', type_parser=argvalidators.ColorArg.type_parser, default='ffffff', metavar=argvalidators.ColorArg.METAVAR, help='Color for the spray emitted when a bubble pops.') class-attribute diff --git a/effects/burn/index.html b/effects/burn/index.html index d665a9e8..0997c063 100755 --- a/effects/burn/index.html +++ b/effects/burn/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1363,7 +1980,7 @@

    - Bases: BaseEffect[BurnConfig]

    + Bases: BaseEffect[BurnConfig]

    Characters are ignited and burn up the screen.

    @@ -1545,7 +2162,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Burn effect.

    @@ -1609,7 +2226,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1708,48 +2325,48 @@

    starting_color: graphics.Color = ArgField( cmd_name="--starting-color", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, default="837373", - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Color of the characters before they start to burn.", ) # type: ignore[assignment] "graphics.Color : Color of the characters before they start to burn." burn_colors: tuple[graphics.Color, ...] = ArgField( cmd_name=["--burn-colors"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, default=("ffffff", "fff75d", "fe650d", "8A003C", "510100"), nargs="+", - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Colors transitioned through as the characters burn.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Colors transitioned through as the characters burn." final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("00c3ff", "ffff1c"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name=["--final-gradient-steps"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." @@ -1775,7 +2392,7 @@

    - burn_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--burn-colors'], type_parser=arg_validators.Color.type_parser, default=('ffffff', 'fff75d', 'fe650d', '8A003C', '510100'), nargs='+', metavar=arg_validators.Color.METAVAR, help='Colors transitioned through as the characters burn.') + burn_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--burn-colors'], type_parser=argvalidators.ColorArg.type_parser, default=('ffffff', 'fff75d', 'fe650d', '8A003C', '510100'), nargs='+', metavar=argvalidators.ColorArg.METAVAR, help='Colors transitioned through as the characters burn.') class-attribute @@ -1797,7 +2414,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1819,7 +2436,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1841,7 +2458,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('00c3ff', 'ffff1c'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('00c3ff', 'ffff1c'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -1863,7 +2480,7 @@

    - starting_color: graphics.Color = ArgField(cmd_name='--starting-color', type_parser=arg_validators.Color.type_parser, default='837373', metavar=arg_validators.Color.METAVAR, help='Color of the characters before they start to burn.') + starting_color: graphics.Color = ArgField(cmd_name='--starting-color', type_parser=argvalidators.ColorArg.type_parser, default='837373', metavar=argvalidators.ColorArg.METAVAR, help='Color of the characters before they start to burn.') class-attribute diff --git a/effects/crumble/index.html b/effects/crumble/index.html index c8d7ad27..0f372255 100755 --- a/effects/crumble/index.html +++ b/effects/crumble/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1327,7 +1944,7 @@

    - Bases: BaseEffect[CrumbleConfig]

    + Bases: BaseEffect[CrumbleConfig]

    Characters crumble into dust before being vacuumed up and reformed.

    @@ -1371,8 +1988,7 @@

    Source code in terminaltexteffects/effects/effect_crumble.py -
    209
    -210
    +              
    210
     211
     212
     213
    @@ -1387,23 +2003,24 @@ 

    222 223 224 -225

    class Crumble(BaseEffect[CrumbleConfig]):
    -    """Characters crumble into dust before being vacuumed up and reformed.
    -
    -    Attributes:
    -        effect_config (CrumbleConfig): Configuration for the effect.
    -        terminal_config (TerminalConfig): Configuration for the terminal.
    -    """
    -
    -    _config_cls = CrumbleConfig
    -    _iterator_cls = CrumbleIterator
    -
    -    def __init__(self, input_data: str) -> None:
    -        """Initialize the effect with the provided input data.
    -
    -        Args:
    -            input_data (str): The input data to use for the effect."""
    -        super().__init__(input_data)
    +225
    +226
    class Crumble(BaseEffect[CrumbleConfig]):
    +    """Characters crumble into dust before being vacuumed up and reformed.
    +
    +    Attributes:
    +        effect_config (CrumbleConfig): Configuration for the effect.
    +        terminal_config (TerminalConfig): Configuration for the terminal.
    +    """
    +
    +    _config_cls = CrumbleConfig
    +    _iterator_cls = CrumbleIterator
    +
    +    def __init__(self, input_data: str) -> None:
    +        """Initialize the effect with the provided input data.
    +
    +        Args:
    +            input_data (str): The input data to use for the effect."""
    +        super().__init__(input_data)
     
    @@ -1466,17 +2083,17 @@

    Source code in terminaltexteffects/effects/effect_crumble.py -
    220
    -221
    +            
    def __init__(self, input_data: str) -> None:
    -    """Initialize the effect with the provided input data.
    -
    -    Args:
    -        input_data (str): The input data to use for the effect."""
    -    super().__init__(input_data)
    +225
    +226
    def __init__(self, input_data: str) -> None:
    +    """Initialize the effect with the provided input data.
    +
    +    Args:
    +        input_data (str): The input data to use for the effect."""
    +    super().__init__(input_data)
     
    @@ -1509,7 +2126,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Crumble effect.

    @@ -1551,7 +2168,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1564,8 +2181,7 @@

    Source code in terminaltexteffects/effects/effect_crumble.py -
    26
    -27
    +              
    27
     28
     29
     30
    @@ -1610,53 +2226,54 @@ 

    69 70 71 -72

    @argclass(
    -    name="crumble",
    -    help="Characters lose color and crumble into dust, vacuumed up, and reformed.",
    -    description="crumble | Characters lose color and crumble into dust, vacuumed up, and reformed.",
    -    epilog="""Example: terminaltexteffects crumble --final-gradient-stops 5CE1FF FF8C00 --final-gradient-steps 12 --final-gradient-direction diagonal""",
    -)
    -@dataclass
    -class CrumbleConfig(ArgsDataClass):
    -    """Configuration for the Crumble effect.
    -
    -    Attributes:
    -        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    -        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    -        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient."""
    -
    -    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--final-gradient-stops"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("5CE1FF", "FF8C00"),
    -        metavar=arg_validators.Color.METAVAR,
    -        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.",
    -    )  # type: ignore[assignment]
    -    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    -
    -    final_gradient_steps: tuple[int, ...] = ArgField(
    -        cmd_name="--final-gradient-steps",
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        nargs="+",
    -        default=(12,),
    -        metavar=arg_validators.PositiveInt.METAVAR,
    -        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    -    )  # type: ignore[assignment]
    -    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    -
    -    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    -        cmd_name="--final-gradient-direction",
    -        type_parser=arg_validators.GradientDirection.type_parser,
    -        default=graphics.Gradient.Direction.DIAGONAL,
    -        metavar=arg_validators.GradientDirection.METAVAR,
    -        help="Direction of the final gradient.",
    -    )  # type: ignore[assignment]
    -    "graphics.Gradient.Direction : Direction of the final gradient."
    -
    -    @classmethod
    -    def get_effect_class(cls):
    -        return Crumble
    +72
    +73
    @argclass(
    +    name="crumble",
    +    help="Characters lose color and crumble into dust, vacuumed up, and reformed.",
    +    description="crumble | Characters lose color and crumble into dust, vacuumed up, and reformed.",
    +    epilog="""Example: terminaltexteffects crumble --final-gradient-stops 5CE1FF FF8C00 --final-gradient-steps 12 --final-gradient-direction diagonal""",
    +)
    +@dataclass
    +class CrumbleConfig(ArgsDataClass):
    +    """Configuration for the Crumble effect.
    +
    +    Attributes:
    +        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    +        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    +        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient."""
    +
    +    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--final-gradient-stops"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("5CE1FF", "FF8C00"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        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.",
    +    )  # type: ignore[assignment]
    +    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    +
    +    final_gradient_steps: tuple[int, ...] = ArgField(
    +        cmd_name="--final-gradient-steps",
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        nargs="+",
    +        default=(12,),
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    +    )  # type: ignore[assignment]
    +    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    +
    +    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    +        cmd_name="--final-gradient-direction",
    +        type_parser=argvalidators.GradientDirection.type_parser,
    +        default=graphics.Gradient.Direction.DIAGONAL,
    +        metavar=argvalidators.GradientDirection.METAVAR,
    +        help="Direction of the final gradient.",
    +    )  # type: ignore[assignment]
    +    "graphics.Gradient.Direction : Direction of the final gradient."
    +
    +    @classmethod
    +    def get_effect_class(cls):
    +        return Crumble
     
    @@ -1675,7 +2292,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1697,7 +2314,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1719,7 +2336,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('5CE1FF', 'FF8C00'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('5CE1FF', 'FF8C00'), metavar=argvalidators.ColorArg.METAVAR, 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 diff --git a/effects/decrypt/index.html b/effects/decrypt/index.html index c410dff1..91bad13b 100755 --- a/effects/decrypt/index.html +++ b/effects/decrypt/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1363,7 +1980,7 @@

    - Bases: BaseEffect[DecryptConfig]

    + Bases: BaseEffect[DecryptConfig]

    Movie style text decryption effect.

    @@ -1407,8 +2024,7 @@

    Source code in terminaltexteffects/effects/effect_decrypt.py -
    215
    -216
    +              
    216
     217
     218
     219
    @@ -1427,27 +2043,28 @@ 

    232 233 234 -235

    class Decrypt(BaseEffect[DecryptConfig]):
    -    """Movie style text decryption effect.
    -
    -    Attributes:
    -        effect_config (DecryptConfig): Configuration for the effect.
    -        terminal_config (TerminalConfig): Configuration for the terminal.
    -
    -    """
    -
    -    _config_cls = DecryptConfig
    -    _iterator_cls = DecryptIterator
    -
    -    def __init__(self, input_data: str) -> None:
    -        """Initialize the effect with the provided input data.
    -
    -        Args:
    -            input_data (str): The input data to use for the effect."""
    -        super().__init__(input_data)
    -
    -    def __iter__(self) -> DecryptIterator:
    -        return DecryptIterator(self)
    +235
    +236
    class Decrypt(BaseEffect[DecryptConfig]):
    +    """Movie style text decryption effect.
    +
    +    Attributes:
    +        effect_config (DecryptConfig): Configuration for the effect.
    +        terminal_config (TerminalConfig): Configuration for the terminal.
    +
    +    """
    +
    +    _config_cls = DecryptConfig
    +    _iterator_cls = DecryptIterator
    +
    +    def __init__(self, input_data: str) -> None:
    +        """Initialize the effect with the provided input data.
    +
    +        Args:
    +            input_data (str): The input data to use for the effect."""
    +        super().__init__(input_data)
    +
    +    def __iter__(self) -> DecryptIterator:
    +        return DecryptIterator(self)
     
    @@ -1510,17 +2127,17 @@

    Source code in terminaltexteffects/effects/effect_decrypt.py -
    227
    -228
    +            
    def __init__(self, input_data: str) -> None:
    -    """Initialize the effect with the provided input data.
    -
    -    Args:
    -        input_data (str): The input data to use for the effect."""
    -    super().__init__(input_data)
    +232
    +233
    def __init__(self, input_data: str) -> None:
    +    """Initialize the effect with the provided input data.
    +
    +    Args:
    +        input_data (str): The input data to use for the effect."""
    +    super().__init__(input_data)
     
    @@ -1553,7 +2170,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Decrypt effect.

    @@ -1617,7 +2234,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1630,8 +2247,7 @@

    Source code in terminaltexteffects/effects/effect_decrypt.py -
    23
    -24
    +              
    24
     25
     26
     27
    @@ -1697,74 +2313,75 @@ 

    87 88 89 -90

    @argclass(
    -    name="decrypt",
    -    help="Display a movie style decryption effect.",
    -    description="decrypt | Movie style decryption effect.",
    -    epilog="Example: terminaltexteffects decrypt --typing-speed 2 --ciphertext-colors 008000 00cb00 00ff00 --final-gradient-stops eda000 --final-gradient-steps 12 --final-gradient-direction vertical",
    -)
    -@dataclass
    -class DecryptConfig(ArgsDataClass):
    -    """Configuration for the Decrypt effect.
    -
    -    Attributes:
    -        typing_speed (int): Number of characters typed per keystroke.
    -        ciphertext_colors (tuple[graphics.Color, ...]): Colors for the ciphertext. Color will be randomly selected for each character.
    -        final_gradient_stops (tuple[graphics.Color, ...]): Colors for the character gradient. If only one color is provided, the characters will be displayed in that color.
    -        final_gradient_steps (tuple[int, ...]): Number of gradient steps to use. More steps will create a smoother and longer gradient animation.
    -        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient."""
    -
    -    typing_speed: int = ArgField(
    -        cmd_name="--typing-speed",
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        default=1,
    -        metavar=arg_validators.PositiveInt.METAVAR,
    -        help="Number of characters typed per keystroke.",
    -    )  # type: ignore[assignment]
    -    "int : Number of characters typed per keystroke."
    -
    -    ciphertext_colors: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--ciphertext-colors"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("008000", "00cb00", "00ff00"),
    -        metavar=arg_validators.Color.METAVAR,
    -        help="Space separated, unquoted, list of colors for the ciphertext. Color will be randomly selected for each character.",
    -    )  # type: ignore[assignment]
    -    "tuple[graphics.Color, ...] : Colors for the ciphertext. Color will be randomly selected for each character."
    -
    -    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--final-gradient-stops"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("eda000",),
    -        metavar=arg_validators.Color.METAVAR,
    -        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.",
    -    )  # type: ignore[assignment]
    -    "tuple[graphics.Color, ...] : Colors for the character gradient. If only one color is provided, the characters will be displayed in that color."
    -
    -    final_gradient_steps: tuple[int, ...] = ArgField(
    -        cmd_name="--final-gradient-steps",
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        nargs="+",
    -        default=(12,),
    -        metavar=arg_validators.PositiveInt.METAVAR,
    -        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    -    )  # type: ignore[assignment]
    -    "tuple[int, ...] : Number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    -
    -    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    -        cmd_name="--final-gradient-direction",
    -        type_parser=arg_validators.GradientDirection.type_parser,
    -        default=graphics.Gradient.Direction.VERTICAL,
    -        metavar=arg_validators.GradientDirection.METAVAR,
    -        help="Direction of the final gradient.",
    -    )  # type: ignore[assignment]
    -    "graphics.Gradient.Direction : Direction of the final gradient."
    -
    -    @classmethod
    -    def get_effect_class(cls):
    -        return Decrypt
    +90
    +91
    @argclass(
    +    name="decrypt",
    +    help="Display a movie style decryption effect.",
    +    description="decrypt | Movie style decryption effect.",
    +    epilog="Example: terminaltexteffects decrypt --typing-speed 2 --ciphertext-colors 008000 00cb00 00ff00 --final-gradient-stops eda000 --final-gradient-steps 12 --final-gradient-direction vertical",
    +)
    +@dataclass
    +class DecryptConfig(ArgsDataClass):
    +    """Configuration for the Decrypt effect.
    +
    +    Attributes:
    +        typing_speed (int): Number of characters typed per keystroke.
    +        ciphertext_colors (tuple[graphics.Color, ...]): Colors for the ciphertext. Color will be randomly selected for each character.
    +        final_gradient_stops (tuple[graphics.Color, ...]): Colors for the character gradient. If only one color is provided, the characters will be displayed in that color.
    +        final_gradient_steps (tuple[int, ...]): Number of gradient steps to use. More steps will create a smoother and longer gradient animation.
    +        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient."""
    +
    +    typing_speed: int = ArgField(
    +        cmd_name="--typing-speed",
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        default=1,
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        help="Number of characters typed per keystroke.",
    +    )  # type: ignore[assignment]
    +    "int : Number of characters typed per keystroke."
    +
    +    ciphertext_colors: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--ciphertext-colors"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("008000", "00cb00", "00ff00"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        help="Space separated, unquoted, list of colors for the ciphertext. Color will be randomly selected for each character.",
    +    )  # type: ignore[assignment]
    +    "tuple[graphics.Color, ...] : Colors for the ciphertext. Color will be randomly selected for each character."
    +
    +    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--final-gradient-stops"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("eda000",),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        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.",
    +    )  # type: ignore[assignment]
    +    "tuple[graphics.Color, ...] : Colors for the character gradient. If only one color is provided, the characters will be displayed in that color."
    +
    +    final_gradient_steps: tuple[int, ...] = ArgField(
    +        cmd_name="--final-gradient-steps",
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        nargs="+",
    +        default=(12,),
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    +    )  # type: ignore[assignment]
    +    "tuple[int, ...] : Number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    +
    +    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    +        cmd_name="--final-gradient-direction",
    +        type_parser=argvalidators.GradientDirection.type_parser,
    +        default=graphics.Gradient.Direction.VERTICAL,
    +        metavar=argvalidators.GradientDirection.METAVAR,
    +        help="Direction of the final gradient.",
    +    )  # type: ignore[assignment]
    +    "graphics.Gradient.Direction : Direction of the final gradient."
    +
    +    @classmethod
    +    def get_effect_class(cls):
    +        return Decrypt
     
    @@ -1783,7 +2400,7 @@

    - ciphertext_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--ciphertext-colors'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('008000', '00cb00', '00ff00'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the ciphertext. Color will be randomly selected for each character.') + ciphertext_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--ciphertext-colors'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('008000', '00cb00', '00ff00'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the ciphertext. Color will be randomly selected for each character.') class-attribute @@ -1805,7 +2422,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1827,7 +2444,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1849,7 +2466,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('eda000'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('eda000'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -1871,7 +2488,7 @@

    - typing_speed: int = ArgField(cmd_name='--typing-speed', type_parser=arg_validators.PositiveInt.type_parser, default=1, metavar=arg_validators.PositiveInt.METAVAR, help='Number of characters typed per keystroke.') + typing_speed: int = ArgField(cmd_name='--typing-speed', type_parser=argvalidators.PositiveInt.type_parser, default=1, metavar=argvalidators.PositiveInt.METAVAR, help='Number of characters typed per keystroke.') class-attribute diff --git a/effects/errorcorrect/index.html b/effects/errorcorrect/index.html index 5e232ffa..7679053e 100755 --- a/effects/errorcorrect/index.html +++ b/effects/errorcorrect/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1417,7 +2034,7 @@

    - Bases: BaseEffect[ErrorCorrectConfig]

    + Bases: BaseEffect[ErrorCorrectConfig]

    Swaps characters from an incorrect initial position to the correct position.

    @@ -1461,8 +2078,7 @@

    Source code in terminaltexteffects/effects/effect_errorcorrect.py -
    249
    -250
    +              
    250
     251
     252
     253
    @@ -1477,23 +2093,24 @@ 

    262 263 264 -265

    class ErrorCorrect(BaseEffect[ErrorCorrectConfig]):
    -    """Swaps characters from an incorrect initial position to the correct position.
    -
    -    Attributes:
    -        effect_config (ErrorCorrectConfig): Configuration for the effect.
    -        terminal_config (TerminalConfig): Configuration for the terminal.
    -    """
    -
    -    _config_cls = ErrorCorrectConfig
    -    _iterator_cls = ErrorCorrectIterator
    -
    -    def __init__(self, input_data: str) -> None:
    -        """Initialize the effect with the provided input data.
    -
    -        Args:
    -            input_data (str): The input data to use for the effect."""
    -        super().__init__(input_data)
    +265
    +266
    class ErrorCorrect(BaseEffect[ErrorCorrectConfig]):
    +    """Swaps characters from an incorrect initial position to the correct position.
    +
    +    Attributes:
    +        effect_config (ErrorCorrectConfig): Configuration for the effect.
    +        terminal_config (TerminalConfig): Configuration for the terminal.
    +    """
    +
    +    _config_cls = ErrorCorrectConfig
    +    _iterator_cls = ErrorCorrectIterator
    +
    +    def __init__(self, input_data: str) -> None:
    +        """Initialize the effect with the provided input data.
    +
    +        Args:
    +            input_data (str): The input data to use for the effect."""
    +        super().__init__(input_data)
     
    @@ -1556,17 +2173,17 @@

    Source code in terminaltexteffects/effects/effect_errorcorrect.py -
    260
    -261
    +            
    def __init__(self, input_data: str) -> None:
    -    """Initialize the effect with the provided input data.
    -
    -    Args:
    -        input_data (str): The input data to use for the effect."""
    -    super().__init__(input_data)
    +265
    +266
    def __init__(self, input_data: str) -> None:
    +    """Initialize the effect with the provided input data.
    +
    +    Args:
    +        input_data (str): The input data to use for the effect."""
    +    super().__init__(input_data)
     
    @@ -1599,7 +2216,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the ErrorCorrect effect.

    @@ -1685,7 +2302,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1709,8 +2326,7 @@

    Source code in terminaltexteffects/effects/effect_errorcorrect.py -
     24
    - 25
    +              
     25
      26
      27
      28
    @@ -1807,105 +2423,106 @@ 

    119 120 121 -122

    @argclass(
    -    name="errorcorrect",
    -    help="Some characters start in the wrong position and are corrected in sequence.",
    -    description="errorcorrect | Some characters start in the wrong position and are corrected in sequence.",
    -    epilog=f"""{arg_validators.EASING_EPILOG}
    -
    -Example: terminaltexteffects errorcorrect --error-pairs 0.1 --swap-delay 10 --error-color e74c3c --correct-color 45bf55 --final-gradient-stops 8A008A 00D1FF FFFFFF --final-gradient-steps 12 --movement-speed 0.5""",
    -)
    -@dataclass
    -class ErrorCorrectConfig(ArgsDataClass):
    -    """Configuration for the ErrorCorrect effect.
    -
    -    Attributes:
    -        error_pairs (float): Percent of characters that are in the wrong position. This is a float between 0 and 1.0. 0.2 means 20 percent of the characters will be in the wrong position. Valid values are 0 < n <= 1.0.
    -        swap_delay (int): Number of frames between swaps. Valid values are n >= 0.
    -        error_color (graphics.Color): Color for the characters that are in the wrong position.
    -        correct_color (graphics.Color): Color for the characters once corrected, this is a gradient from error-color and fades to final-color.
    -        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    -        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    -        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient.
    -        movement_speed (float): Speed of the characters while moving to the correct position. Valid values are n > 0."""
    -
    -    error_pairs: float = ArgField(
    -        cmd_name="--error-pairs",
    -        type_parser=arg_validators.PositiveFloat.type_parser,
    -        default=0.1,
    -        metavar="(int > 0)",
    -        help="Percent of characters that are in the wrong position. This is a float between 0 and 1.0. 0.2 means 20 percent of the characters will be in the wrong position.",
    -    )  # type: ignore[assignment]
    -    "float : Percent of characters that are in the wrong position. This is a float between 0 and 1.0. 0.2 means 20 percent of the characters will be in the wrong position."
    -
    -    swap_delay: int = ArgField(
    -        cmd_name="--swap-delay",
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        default=10,
    -        metavar="(int > 0)",
    -        help="Number of frames between swaps.",
    -    )  # type: ignore[assignment]
    -    "int : Number of frames between swaps."
    -
    -    error_color: graphics.Color = ArgField(
    -        cmd_name=["--error-color"],
    -        type_parser=arg_validators.Color.type_parser,
    -        default="e74c3c",
    -        metavar="(XTerm [0-255] OR RGB Hex [000000-ffffff])",
    -        help="Color for the characters that are in the wrong position.",
    -    )  # type: ignore[assignment]
    -    "graphics.Color : Color for the characters that are in the wrong position."
    -
    -    correct_color: graphics.Color = ArgField(
    -        cmd_name=["--correct-color"],
    -        type_parser=arg_validators.Color.type_parser,
    -        default="45bf55",
    -        metavar="(XTerm [0-255] OR RGB Hex [000000-ffffff])",
    -        help="Color for the characters once corrected, this is a gradient from error-color and fades to final-color.",
    -    )  # type: ignore[assignment]
    -    "graphics.Color : Color for the characters once corrected, this is a gradient from error-color and fades to final-color."
    -
    -    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--final-gradient-stops"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("8A008A", "00D1FF", "FFFFFF"),
    -        metavar="(XTerm [0-255] OR RGB Hex [000000-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.",
    -    )  # type: ignore[assignment]
    -    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    -
    -    final_gradient_steps: tuple[int, ...] = ArgField(
    -        cmd_name="--final-gradient-steps",
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        nargs="+",
    -        default=(12,),
    -        metavar="(int > 0)",
    -        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    -    )  # type: ignore[assignment]
    -    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    -
    -    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    -        cmd_name="--final-gradient-direction",
    -        type_parser=arg_validators.GradientDirection.type_parser,
    -        default=graphics.Gradient.Direction.VERTICAL,
    -        metavar=arg_validators.GradientDirection.METAVAR,
    -        help="Direction of the final gradient.",
    -    )  # type: ignore[assignment]
    -    "graphics.Gradient.Direction : Direction of the final gradient."
    -
    -    movement_speed: float = ArgField(
    -        cmd_name="--movement-speed",
    -        type_parser=arg_validators.PositiveFloat.type_parser,
    -        default=0.5,
    -        metavar="(float > 0)",
    -        help="Speed of the characters while moving to the correct position. ",
    -    )  # type: ignore[assignment]
    -    "float : Speed of the characters while moving to the correct position. "
    -
    -    @classmethod
    -    def get_effect_class(cls):
    -        return ErrorCorrect
    +122
    +123
    @argclass(
    +    name="errorcorrect",
    +    help="Some characters start in the wrong position and are corrected in sequence.",
    +    description="errorcorrect | Some characters start in the wrong position and are corrected in sequence.",
    +    epilog=f"""{argvalidators.EASING_EPILOG}
    +
    +Example: terminaltexteffects errorcorrect --error-pairs 0.1 --swap-delay 10 --error-color e74c3c --correct-color 45bf55 --final-gradient-stops 8A008A 00D1FF FFFFFF --final-gradient-steps 12 --movement-speed 0.5""",
    +)
    +@dataclass
    +class ErrorCorrectConfig(ArgsDataClass):
    +    """Configuration for the ErrorCorrect effect.
    +
    +    Attributes:
    +        error_pairs (float): Percent of characters that are in the wrong position. This is a float between 0 and 1.0. 0.2 means 20 percent of the characters will be in the wrong position. Valid values are 0 < n <= 1.0.
    +        swap_delay (int): Number of frames between swaps. Valid values are n >= 0.
    +        error_color (graphics.Color): Color for the characters that are in the wrong position.
    +        correct_color (graphics.Color): Color for the characters once corrected, this is a gradient from error-color and fades to final-color.
    +        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    +        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    +        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient.
    +        movement_speed (float): Speed of the characters while moving to the correct position. Valid values are n > 0."""
    +
    +    error_pairs: float = ArgField(
    +        cmd_name="--error-pairs",
    +        type_parser=argvalidators.PositiveFloat.type_parser,
    +        default=0.1,
    +        metavar="(int > 0)",
    +        help="Percent of characters that are in the wrong position. This is a float between 0 and 1.0. 0.2 means 20 percent of the characters will be in the wrong position.",
    +    )  # type: ignore[assignment]
    +    "float : Percent of characters that are in the wrong position. This is a float between 0 and 1.0. 0.2 means 20 percent of the characters will be in the wrong position."
    +
    +    swap_delay: int = ArgField(
    +        cmd_name="--swap-delay",
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        default=10,
    +        metavar="(int > 0)",
    +        help="Number of frames between swaps.",
    +    )  # type: ignore[assignment]
    +    "int : Number of frames between swaps."
    +
    +    error_color: graphics.Color = ArgField(
    +        cmd_name=["--error-color"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        default="e74c3c",
    +        metavar="(XTerm [0-255] OR RGB Hex [000000-ffffff])",
    +        help="Color for the characters that are in the wrong position.",
    +    )  # type: ignore[assignment]
    +    "graphics.Color : Color for the characters that are in the wrong position."
    +
    +    correct_color: graphics.Color = ArgField(
    +        cmd_name=["--correct-color"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        default="45bf55",
    +        metavar="(XTerm [0-255] OR RGB Hex [000000-ffffff])",
    +        help="Color for the characters once corrected, this is a gradient from error-color and fades to final-color.",
    +    )  # type: ignore[assignment]
    +    "graphics.Color : Color for the characters once corrected, this is a gradient from error-color and fades to final-color."
    +
    +    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--final-gradient-stops"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("8A008A", "00D1FF", "FFFFFF"),
    +        metavar="(XTerm [0-255] OR RGB Hex [000000-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.",
    +    )  # type: ignore[assignment]
    +    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    +
    +    final_gradient_steps: tuple[int, ...] = ArgField(
    +        cmd_name="--final-gradient-steps",
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        nargs="+",
    +        default=(12,),
    +        metavar="(int > 0)",
    +        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    +    )  # type: ignore[assignment]
    +    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    +
    +    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    +        cmd_name="--final-gradient-direction",
    +        type_parser=argvalidators.GradientDirection.type_parser,
    +        default=graphics.Gradient.Direction.VERTICAL,
    +        metavar=argvalidators.GradientDirection.METAVAR,
    +        help="Direction of the final gradient.",
    +    )  # type: ignore[assignment]
    +    "graphics.Gradient.Direction : Direction of the final gradient."
    +
    +    movement_speed: float = ArgField(
    +        cmd_name="--movement-speed",
    +        type_parser=argvalidators.PositiveFloat.type_parser,
    +        default=0.5,
    +        metavar="(float > 0)",
    +        help="Speed of the characters while moving to the correct position. ",
    +    )  # type: ignore[assignment]
    +    "float : Speed of the characters while moving to the correct position. "
    +
    +    @classmethod
    +    def get_effect_class(cls):
    +        return ErrorCorrect
     
    @@ -1924,7 +2541,7 @@

    - correct_color: graphics.Color = ArgField(cmd_name=['--correct-color'], type_parser=arg_validators.Color.type_parser, default='45bf55', metavar='(XTerm [0-255] OR RGB Hex [000000-ffffff])', help='Color for the characters once corrected, this is a gradient from error-color and fades to final-color.') + correct_color: graphics.Color = ArgField(cmd_name=['--correct-color'], type_parser=argvalidators.ColorArg.type_parser, default='45bf55', metavar='(XTerm [0-255] OR RGB Hex [000000-ffffff])', help='Color for the characters once corrected, this is a gradient from error-color and fades to final-color.') class-attribute @@ -1946,7 +2563,7 @@

    - error_color: graphics.Color = ArgField(cmd_name=['--error-color'], type_parser=arg_validators.Color.type_parser, default='e74c3c', metavar='(XTerm [0-255] OR RGB Hex [000000-ffffff])', help='Color for the characters that are in the wrong position.') + error_color: graphics.Color = ArgField(cmd_name=['--error-color'], type_parser=argvalidators.ColorArg.type_parser, default='e74c3c', metavar='(XTerm [0-255] OR RGB Hex [000000-ffffff])', help='Color for the characters that are in the wrong position.') class-attribute @@ -1968,7 +2585,7 @@

    - error_pairs: float = ArgField(cmd_name='--error-pairs', type_parser=arg_validators.PositiveFloat.type_parser, default=0.1, metavar='(int > 0)', help='Percent of characters that are in the wrong position. This is a float between 0 and 1.0. 0.2 means 20 percent of the characters will be in the wrong position.') + error_pairs: float = ArgField(cmd_name='--error-pairs', type_parser=argvalidators.PositiveFloat.type_parser, default=0.1, metavar='(int > 0)', help='Percent of characters that are in the wrong position. This is a float between 0 and 1.0. 0.2 means 20 percent of the characters will be in the wrong position.') class-attribute @@ -1990,7 +2607,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -2012,7 +2629,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar='(int > 0)', help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar='(int > 0)', help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2034,7 +2651,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar='(XTerm [0-255] OR RGB Hex [000000-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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar='(XTerm [0-255] OR RGB Hex [000000-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 @@ -2056,7 +2673,7 @@

    - movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=0.5, metavar='(float > 0)', help='Speed of the characters while moving to the correct position. ') + movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=0.5, metavar='(float > 0)', help='Speed of the characters while moving to the correct position. ') class-attribute @@ -2078,7 +2695,7 @@

    - swap_delay: int = ArgField(cmd_name='--swap-delay', type_parser=arg_validators.PositiveInt.type_parser, default=10, metavar='(int > 0)', help='Number of frames between swaps.') + swap_delay: int = ArgField(cmd_name='--swap-delay', type_parser=argvalidators.PositiveInt.type_parser, default=10, metavar='(int > 0)', help='Number of frames between swaps.') class-attribute diff --git a/effects/expand/index.html b/effects/expand/index.html index 8b410803..c1b4d3c1 100755 --- a/effects/expand/index.html +++ b/effects/expand/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1381,7 +1998,7 @@

    - Bases: BaseEffect[ExpandConfig]

    + Bases: BaseEffect[ExpandConfig]

    Characters expand from the center.

    @@ -1565,7 +2182,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Expand effect.

    @@ -1618,7 +2235,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1734,7 +2351,7 @@

    name="expand", help="Expands the text from a single point.", description="expand | Expands the text from a single point.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects expand --final-gradient-stops 8A008A 00D1FF FFFFFF --final-gradient-steps 12 --final-gradient-frames 5 --movement-speed 0.35 --expand-easing IN_OUT_QUART""", ) @@ -1752,47 +2369,47 @@

    final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("8A008A", "00D1FF", "FFFFFF"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_frames: int = ArgField( cmd_name="--final-gradient-frames", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=5, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of frames to display each gradient step.", ) # type: ignore[assignment] "int : Number of frames to display each gradient step." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." movement_speed: float = ArgField( cmd_name="--movement-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.35, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Movement speed of the characters. ", ) # type: ignore[assignment] "float : Movement speed of the characters. " @@ -1800,7 +2417,7 @@

    expand_easing: easing.EasingFunction = ArgField( cmd_name="--expand-easing", default=easing.in_out_quart, - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, help="Easing function to use for character movement.", ) # type: ignore[assignment] "easing.EasingFunction : Easing function to use for character movement." @@ -1826,7 +2443,7 @@

    - expand_easing: easing.EasingFunction = ArgField(cmd_name='--expand-easing', default=easing.in_out_quart, type_parser=arg_validators.Ease.type_parser, help='Easing function to use for character movement.') + expand_easing: easing.EasingFunction = ArgField(cmd_name='--expand-easing', default=easing.in_out_quart, type_parser=argvalidators.Ease.type_parser, help='Easing function to use for character movement.') class-attribute @@ -1848,7 +2465,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1870,7 +2487,7 @@

    - final_gradient_frames: int = ArgField(cmd_name='--final-gradient-frames', type_parser=arg_validators.PositiveInt.type_parser, default=5, metavar=arg_validators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') + final_gradient_frames: int = 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.') class-attribute @@ -1892,7 +2509,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1914,7 +2531,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -1936,7 +2553,7 @@

    - movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=0.35, metavar=arg_validators.PositiveFloat.METAVAR, help='Movement speed of the characters. ') + movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=0.35, metavar=argvalidators.PositiveFloat.METAVAR, help='Movement speed of the characters. ') class-attribute diff --git a/effects/fireworks/index.html b/effects/fireworks/index.html index c4b99640..32ef41ef 100755 --- a/effects/fireworks/index.html +++ b/effects/fireworks/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1435,7 +2052,7 @@

    - Bases: BaseEffect[FireworksConfig]

    + Bases: BaseEffect[FireworksConfig]

    Launches characters up the screen where they explode like fireworks and fall into place.

    @@ -1619,7 +2236,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Fireworks effect.

    @@ -1705,7 +2322,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1877,66 +2494,66 @@

    firework_colors: tuple[graphics.Color, ...] = ArgField( cmd_name="--firework-colors", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("88F7E2", "44D492", "F5EB67", "FFA15C", "FA233E"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Space separated list of colors from which firework colors will be randomly selected.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors from which firework colors will be randomly selected." firework_symbol: str = ArgField( cmd_name="--firework-symbol", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, default="o", - metavar=arg_validators.Symbol.METAVAR, + metavar=argvalidators.Symbol.METAVAR, help="Symbol to use for the firework shell.", ) # type: ignore[assignment] "str : Symbol to use for the firework shell." firework_volume: float = ArgField( cmd_name="--firework-volume", - type_parser=arg_validators.Ratio.type_parser, + type_parser=argvalidators.Ratio.type_parser, default=0.02, - metavar=arg_validators.Ratio.METAVAR, + metavar=argvalidators.Ratio.METAVAR, help="Percent of total characters in each firework shell.", ) # type: ignore[assignment] "float : Percent of total characters in each firework shell." final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name="--final-gradient-stops", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("8A008A", "00D1FF", "FFFFFF"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.HORIZONTAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." launch_delay: int = ArgField( cmd_name="--launch-delay", - type_parser=arg_validators.NonNegativeInt.type_parser, + type_parser=argvalidators.NonNegativeInt.type_parser, default=60, - metavar=arg_validators.NonNegativeInt.METAVAR, + metavar=argvalidators.NonNegativeInt.METAVAR, help="Number of frames to wait between launching each firework shell. +/- 0-50 percent randomness is applied to this value.", ) # type: ignore[assignment] "int : Number of frames to wait between launching each firework shell. +/- 0-50 percent randomness is applied to this value." @@ -1944,8 +2561,8 @@

    explode_distance: float = ArgField( cmd_name="--explode-distance", default=0.1, - type_parser=arg_validators.Ratio.type_parser, - metavar=arg_validators.Ratio.METAVAR, + type_parser=argvalidators.Ratio.type_parser, + metavar=argvalidators.Ratio.METAVAR, help="Maximum distance from the firework shell origin to the explode waypoint as a percentage of the total output area width.", ) # type: ignore[assignment] "float : Maximum distance from the firework shell origin to the explode waypoint as a percentage of the total output area width." @@ -1993,7 +2610,7 @@

    - explode_distance: float = ArgField(cmd_name='--explode-distance', default=0.1, type_parser=arg_validators.Ratio.type_parser, metavar=arg_validators.Ratio.METAVAR, help='Maximum distance from the firework shell origin to the explode waypoint as a percentage of the total output area width.') + explode_distance: float = ArgField(cmd_name='--explode-distance', default=0.1, type_parser=argvalidators.Ratio.type_parser, metavar=argvalidators.Ratio.METAVAR, help='Maximum distance from the firework shell origin to the explode waypoint as a percentage of the total output area width.') class-attribute @@ -2015,7 +2632,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.HORIZONTAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.HORIZONTAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -2037,7 +2654,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2059,7 +2676,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2081,7 +2698,7 @@

    - firework_colors: tuple[graphics.Color, ...] = ArgField(cmd_name='--firework-colors', type_parser=arg_validators.Color.type_parser, nargs='+', default=('88F7E2', '44D492', 'F5EB67', 'FFA15C', 'FA233E'), metavar=arg_validators.Color.METAVAR, help='Space separated list of colors from which firework colors will be randomly selected.') + firework_colors: tuple[graphics.Color, ...] = ArgField(cmd_name='--firework-colors', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('88F7E2', '44D492', 'F5EB67', 'FFA15C', 'FA233E'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated list of colors from which firework colors will be randomly selected.') class-attribute @@ -2103,7 +2720,7 @@

    - firework_symbol: str = ArgField(cmd_name='--firework-symbol', type_parser=arg_validators.Symbol.type_parser, default='o', metavar=arg_validators.Symbol.METAVAR, help='Symbol to use for the firework shell.') + firework_symbol: str = ArgField(cmd_name='--firework-symbol', type_parser=argvalidators.Symbol.type_parser, default='o', metavar=argvalidators.Symbol.METAVAR, help='Symbol to use for the firework shell.') class-attribute @@ -2125,7 +2742,7 @@

    - firework_volume: float = ArgField(cmd_name='--firework-volume', type_parser=arg_validators.Ratio.type_parser, default=0.02, metavar=arg_validators.Ratio.METAVAR, help='Percent of total characters in each firework shell.') + firework_volume: float = ArgField(cmd_name='--firework-volume', type_parser=argvalidators.Ratio.type_parser, default=0.02, metavar=argvalidators.Ratio.METAVAR, help='Percent of total characters in each firework shell.') class-attribute @@ -2147,7 +2764,7 @@

    - launch_delay: int = ArgField(cmd_name='--launch-delay', type_parser=arg_validators.NonNegativeInt.type_parser, default=60, metavar=arg_validators.NonNegativeInt.METAVAR, help='Number of frames to wait between launching each firework shell. +/- 0-50 percent randomness is applied to this value.') + launch_delay: int = ArgField(cmd_name='--launch-delay', type_parser=argvalidators.NonNegativeInt.type_parser, default=60, metavar=argvalidators.NonNegativeInt.METAVAR, help='Number of frames to wait between launching each firework shell. +/- 0-50 percent randomness is applied to this value.') class-attribute diff --git a/effects/middleout/index.html b/effects/middleout/index.html index 39190c54..b41edbab 100755 --- a/effects/middleout/index.html +++ b/effects/middleout/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1435,7 +2052,7 @@

    - Bases: BaseEffect[MiddleOutConfig]

    + Bases: BaseEffect[MiddleOutConfig]

    Text expands in a single row or column in the middle of the output area then out.

    @@ -1617,7 +2234,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Middleout effect.

    @@ -1670,7 +2287,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1810,7 +2427,7 @@

    name="middleout", help="Text expands in a single row or column in the middle of the output area then out.", description="middleout | Text expands in a single row or column in the middle of the output area then out.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects middleout --starting-color 8A008A --final-gradient-stops 8A008A 00D1FF FFFFFF --final-gradient-steps 12 --expand-direction vertical --center-movement-speed 0.35 --full-movement-speed 0.35 --center-easing IN_OUT_SINE --full-easing IN_OUT_SINE""", ) @dataclass @@ -1827,38 +2444,38 @@

    starting_color: graphics.Color = ArgField( cmd_name="--starting-color", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, default="ffffff", - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Color for the initial text in the center of the output area.", ) # type: ignore[assignment] "graphics.Color : Color for the initial text in the center of the output area." final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name="--final-gradient-stops", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("8A008A", "00D1FF", "FFFFFF"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." @@ -1873,18 +2490,18 @@

    center_movement_speed: float = ArgField( cmd_name="--center-movement-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.35, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Speed of the characters during the initial expansion of the center vertical/horiztonal line. ", ) # type: ignore[assignment] "float : Speed of the characters during the initial expansion of the center vertical/horiztonal line. " full_movement_speed: float = ArgField( cmd_name="--full-movement-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.35, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Speed of the characters during the final full expansion. ", ) # type: ignore[assignment] "float : Speed of the characters during the final full expansion. " @@ -1892,7 +2509,7 @@

    center_easing: easing.EasingFunction = ArgField( cmd_name="--center-easing", default=easing.in_out_sine, - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, help="Easing function to use for initial expansion.", ) # type: ignore[assignment] "easing.EasingFunction : Easing function to use for initial expansion." @@ -1900,7 +2517,7 @@

    full_easing: easing.EasingFunction = ArgField( cmd_name="--full-easing", default=easing.in_out_sine, - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, help="Easing function to use for full expansion.", ) # type: ignore[assignment] "easing.EasingFunction : Easing function to use for full expansion." @@ -1926,7 +2543,7 @@

    - center_easing: easing.EasingFunction = ArgField(cmd_name='--center-easing', default=easing.in_out_sine, type_parser=arg_validators.Ease.type_parser, help='Easing function to use for initial expansion.') + center_easing: easing.EasingFunction = ArgField(cmd_name='--center-easing', default=easing.in_out_sine, type_parser=argvalidators.Ease.type_parser, help='Easing function to use for initial expansion.') class-attribute @@ -1948,7 +2565,7 @@

    - center_movement_speed: float = ArgField(cmd_name='--center-movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=0.35, metavar=arg_validators.PositiveFloat.METAVAR, help='Speed of the characters during the initial expansion of the center vertical/horiztonal line. ') + center_movement_speed: float = ArgField(cmd_name='--center-movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=0.35, metavar=argvalidators.PositiveFloat.METAVAR, help='Speed of the characters during the initial expansion of the center vertical/horiztonal line. ') class-attribute @@ -1992,7 +2609,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -2014,7 +2631,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2036,7 +2653,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2058,7 +2675,7 @@

    - full_easing: easing.EasingFunction = ArgField(cmd_name='--full-easing', default=easing.in_out_sine, type_parser=arg_validators.Ease.type_parser, help='Easing function to use for full expansion.') + full_easing: easing.EasingFunction = ArgField(cmd_name='--full-easing', default=easing.in_out_sine, type_parser=argvalidators.Ease.type_parser, help='Easing function to use for full expansion.') class-attribute @@ -2080,7 +2697,7 @@

    - full_movement_speed: float = ArgField(cmd_name='--full-movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=0.35, metavar=arg_validators.PositiveFloat.METAVAR, help='Speed of the characters during the final full expansion. ') + full_movement_speed: float = ArgField(cmd_name='--full-movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=0.35, metavar=argvalidators.PositiveFloat.METAVAR, help='Speed of the characters during the final full expansion. ') class-attribute @@ -2102,7 +2719,7 @@

    - starting_color: graphics.Color = ArgField(cmd_name='--starting-color', type_parser=arg_validators.Color.type_parser, default='ffffff', metavar=arg_validators.Color.METAVAR, help='Color for the initial text in the center of the output area.') + starting_color: graphics.Color = ArgField(cmd_name='--starting-color', type_parser=argvalidators.ColorArg.type_parser, default='ffffff', metavar=argvalidators.ColorArg.METAVAR, help='Color for the initial text in the center of the output area.') class-attribute diff --git a/effects/orbittingvolley/index.html b/effects/orbittingvolley/index.html index 3198456d..b72d9370 100755 --- a/effects/orbittingvolley/index.html +++ b/effects/orbittingvolley/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1489,7 +2106,7 @@

    - Bases: BaseEffect[OrbittingVolleyConfig]

    + Bases: BaseEffect[OrbittingVolleyConfig]

    Four launchers orbit the output area firing volleys of characters inward to build the input text from the center out.

    @@ -1671,7 +2288,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the OrbittingVolley effect.

    @@ -1757,7 +2374,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1967,7 +2584,7 @@

    name="orbittingvolley", help="Four launchers orbit the output area firing volleys of characters inward to build the input text from the center out.", description="orbittingvolley | Four launchers orbit the output area firing volleys of characters inward to build the input text from the center out.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects orbittingvolley --top-launcher-symbol █ --right-launcher-symbol █ --bottom-launcher-symbol █ --left-launcher-symbol █ --final-gradient-stops FFA15C 44D492 --final-gradient-steps 12 --launcher-movement-speed 0.5 --character-movement-speed 1 --volley-size 0.03 --launch-delay 50 --character-easing OUT_SINE""", ) @@ -1991,101 +2608,101 @@

    top_launcher_symbol: str = ArgField( cmd_name="--top-launcher-symbol", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, default="█", - metavar=arg_validators.Symbol.METAVAR, + metavar=argvalidators.Symbol.METAVAR, help="Symbol for the top launcher.", ) # type: ignore[assignment] "str : Symbol for the top launcher." right_launcher_symbol: str = ArgField( cmd_name="--right-launcher-symbol", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, default="█", - metavar=arg_validators.Symbol.METAVAR, + metavar=argvalidators.Symbol.METAVAR, help="Symbol for the right launcher.", ) # type: ignore[assignment] "str : Symbol for the right launcher." bottom_launcher_symbol: str = ArgField( cmd_name="--bottom-launcher-symbol", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, default="█", - metavar=arg_validators.Symbol.METAVAR, + metavar=argvalidators.Symbol.METAVAR, help="Symbol for the bottom launcher.", ) # type: ignore[assignment] "str : Symbol for the bottom launcher." left_launcher_symbol: str = ArgField( cmd_name="--left-launcher-symbol", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, default="█", - metavar=arg_validators.Symbol.METAVAR, + metavar=argvalidators.Symbol.METAVAR, help="Symbol for the left launcher.", ) # type: ignore[assignment] "str : Symbol for the left launcher." final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name="--final-gradient-stops", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("FFA15C", "44D492"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.CENTER, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." launcher_movement_speed: float = ArgField( cmd_name="--launcher-movement-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.5, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Orbitting speed of the launchers.", ) # type: ignore[assignment] "float : Orbitting speed of the launchers." character_movement_speed: float = ArgField( cmd_name="--character-movement-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=1, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Speed of the launched characters.", ) # type: ignore[assignment] "float : Speed of the launched characters." volley_size: float = ArgField( cmd_name="--volley-size", - type_parser=arg_validators.Ratio.type_parser, + type_parser=argvalidators.Ratio.type_parser, default=0.03, - metavar=arg_validators.Ratio.METAVAR, + metavar=argvalidators.Ratio.METAVAR, help="Percent of total input characters each launcher will fire per volley. Lower limit of one character.", ) # type: ignore[assignment] "float : Percent of total input characters each launcher will fire per volley. Lower limit of one character." launch_delay: int = ArgField( cmd_name="--launch-delay", - type_parser=arg_validators.NonNegativeInt.type_parser, + type_parser=argvalidators.NonNegativeInt.type_parser, default=50, - metavar=arg_validators.NonNegativeInt.METAVAR, + metavar=argvalidators.NonNegativeInt.METAVAR, help="Number of animation ticks to wait between volleys of characters.", ) # type: ignore[assignment] "int : Number of animation ticks to wait between volleys of characters." @@ -2093,8 +2710,8 @@

    character_easing: easing.EasingFunction = ArgField( cmd_name=["--character-easing"], default=easing.out_sine, - type_parser=arg_validators.Ease.type_parser, - metavar=arg_validators.Ease.METAVAR, + type_parser=argvalidators.Ease.type_parser, + metavar=argvalidators.Ease.METAVAR, help="Easing function to use for launched character movement.", ) # type: ignore[assignment] "easing.EasingFunction : Easing function to use for launched character movement." @@ -2120,7 +2737,7 @@

    - bottom_launcher_symbol: str = ArgField(cmd_name='--bottom-launcher-symbol', type_parser=arg_validators.Symbol.type_parser, default='█', metavar=arg_validators.Symbol.METAVAR, help='Symbol for the bottom launcher.') + bottom_launcher_symbol: str = ArgField(cmd_name='--bottom-launcher-symbol', type_parser=argvalidators.Symbol.type_parser, default='█', metavar=argvalidators.Symbol.METAVAR, help='Symbol for the bottom launcher.') class-attribute @@ -2142,7 +2759,7 @@

    - character_easing: easing.EasingFunction = ArgField(cmd_name=['--character-easing'], default=easing.out_sine, type_parser=arg_validators.Ease.type_parser, metavar=arg_validators.Ease.METAVAR, help='Easing function to use for launched character movement.') + character_easing: easing.EasingFunction = ArgField(cmd_name=['--character-easing'], default=easing.out_sine, type_parser=argvalidators.Ease.type_parser, metavar=argvalidators.Ease.METAVAR, help='Easing function to use for launched character movement.') class-attribute @@ -2164,7 +2781,7 @@

    - character_movement_speed: float = ArgField(cmd_name='--character-movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=1, metavar=arg_validators.PositiveFloat.METAVAR, help='Speed of the launched characters.') + character_movement_speed: float = ArgField(cmd_name='--character-movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=1, metavar=argvalidators.PositiveFloat.METAVAR, help='Speed of the launched characters.') class-attribute @@ -2186,7 +2803,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.CENTER, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.CENTER, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -2208,7 +2825,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2230,7 +2847,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=arg_validators.Color.type_parser, nargs='+', default=('FFA15C', '44D492'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('FFA15C', '44D492'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2252,7 +2869,7 @@

    - launch_delay: int = ArgField(cmd_name='--launch-delay', type_parser=arg_validators.NonNegativeInt.type_parser, default=50, metavar=arg_validators.NonNegativeInt.METAVAR, help='Number of animation ticks to wait between volleys of characters.') + launch_delay: int = ArgField(cmd_name='--launch-delay', type_parser=argvalidators.NonNegativeInt.type_parser, default=50, metavar=argvalidators.NonNegativeInt.METAVAR, help='Number of animation ticks to wait between volleys of characters.') class-attribute @@ -2274,7 +2891,7 @@

    - launcher_movement_speed: float = ArgField(cmd_name='--launcher-movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=0.5, metavar=arg_validators.PositiveFloat.METAVAR, help='Orbitting speed of the launchers.') + launcher_movement_speed: float = ArgField(cmd_name='--launcher-movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=0.5, metavar=argvalidators.PositiveFloat.METAVAR, help='Orbitting speed of the launchers.') class-attribute @@ -2296,7 +2913,7 @@

    - left_launcher_symbol: str = ArgField(cmd_name='--left-launcher-symbol', type_parser=arg_validators.Symbol.type_parser, default='█', metavar=arg_validators.Symbol.METAVAR, help='Symbol for the left launcher.') + left_launcher_symbol: str = ArgField(cmd_name='--left-launcher-symbol', type_parser=argvalidators.Symbol.type_parser, default='█', metavar=argvalidators.Symbol.METAVAR, help='Symbol for the left launcher.') class-attribute @@ -2318,7 +2935,7 @@

    - right_launcher_symbol: str = ArgField(cmd_name='--right-launcher-symbol', type_parser=arg_validators.Symbol.type_parser, default='█', metavar=arg_validators.Symbol.METAVAR, help='Symbol for the right launcher.') + right_launcher_symbol: str = ArgField(cmd_name='--right-launcher-symbol', type_parser=argvalidators.Symbol.type_parser, default='█', metavar=argvalidators.Symbol.METAVAR, help='Symbol for the right launcher.') class-attribute @@ -2340,7 +2957,7 @@

    - top_launcher_symbol: str = ArgField(cmd_name='--top-launcher-symbol', type_parser=arg_validators.Symbol.type_parser, default='█', metavar=arg_validators.Symbol.METAVAR, help='Symbol for the top launcher.') + top_launcher_symbol: str = ArgField(cmd_name='--top-launcher-symbol', type_parser=argvalidators.Symbol.type_parser, default='█', metavar=argvalidators.Symbol.METAVAR, help='Symbol for the top launcher.') class-attribute @@ -2362,7 +2979,7 @@

    - volley_size: float = ArgField(cmd_name='--volley-size', type_parser=arg_validators.Ratio.type_parser, default=0.03, metavar=arg_validators.Ratio.METAVAR, help='Percent of total input characters each launcher will fire per volley. Lower limit of one character.') + volley_size: float = ArgField(cmd_name='--volley-size', type_parser=argvalidators.Ratio.type_parser, default=0.03, metavar=argvalidators.Ratio.METAVAR, help='Percent of total input characters each launcher will fire per volley. Lower limit of one character.') class-attribute diff --git a/effects/overflow/index.html b/effects/overflow/index.html index 24470ba3..d2940640 100755 --- a/effects/overflow/index.html +++ b/effects/overflow/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1381,7 +1998,7 @@

    - Bases: BaseEffect[OverflowConfig]

    + Bases: BaseEffect[OverflowConfig]

    Input text overflows ands scrolls the terminal in a random order until eventually appearing ordered.

    @@ -1563,7 +2180,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Overflow effect.

    @@ -1605,7 +2222,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1748,57 +2365,57 @@

    final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("8A008A", "00D1FF", "FFFFFF"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name=["--final-gradient-steps"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." overflow_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--overflow-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("f2ebc0", "8dbfb3", "f2ebc0"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Space separated, unquoted, list of colors for the overflow gradient.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the overflow gradient." overflow_cycles_range: tuple[int, int] = ArgField( cmd_name=["--overflow-cycles-range"], - type_parser=arg_validators.IntRange.type_parser, + type_parser=argvalidators.IntRange.type_parser, default=(2, 4), - metavar=arg_validators.IntRange.METAVAR, + metavar=argvalidators.IntRange.METAVAR, help="Number of cycles to overflow the text.", ) # type: ignore[assignment] "tuple[int, int] : Lower and upper range of the number of cycles to overflow the text." overflow_speed: int = ArgField( cmd_name=["--overflow-speed"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=3, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Speed of the overflow effect.", ) # type: ignore[assignment] "int : Speed of the overflow effect." @@ -1824,7 +2441,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1846,7 +2463,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1868,7 +2485,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -1890,7 +2507,7 @@

    - overflow_cycles_range: tuple[int, int] = ArgField(cmd_name=['--overflow-cycles-range'], type_parser=arg_validators.IntRange.type_parser, default=(2, 4), metavar=arg_validators.IntRange.METAVAR, help='Number of cycles to overflow the text.') + overflow_cycles_range: tuple[int, int] = ArgField(cmd_name=['--overflow-cycles-range'], type_parser=argvalidators.IntRange.type_parser, default=(2, 4), metavar=argvalidators.IntRange.METAVAR, help='Number of cycles to overflow the text.') class-attribute @@ -1912,7 +2529,7 @@

    - overflow_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--overflow-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('f2ebc0', '8dbfb3', 'f2ebc0'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the overflow gradient.') + overflow_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--overflow-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('f2ebc0', '8dbfb3', 'f2ebc0'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the overflow gradient.') class-attribute @@ -1934,7 +2551,7 @@

    - overflow_speed: int = ArgField(cmd_name=['--overflow-speed'], type_parser=arg_validators.PositiveInt.type_parser, default=3, metavar=arg_validators.PositiveInt.METAVAR, help='Speed of the overflow effect.') + overflow_speed: int = ArgField(cmd_name=['--overflow-speed'], type_parser=argvalidators.PositiveInt.type_parser, default=3, metavar=argvalidators.PositiveInt.METAVAR, help='Speed of the overflow effect.') class-attribute diff --git a/effects/pour/index.html b/effects/pour/index.html index 7ede7290..e5ad4993 100755 --- a/effects/pour/index.html +++ b/effects/pour/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1453,7 +2070,7 @@

    - Bases: BaseEffect[PourConfig]

    + Bases: BaseEffect[PourConfig]

    Pours the characters back and forth from the top, bottom, left, or right.

    @@ -1635,7 +2252,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Pour effect.

    @@ -1743,7 +2360,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1885,7 +2502,7 @@

    name="pour", help="Pours the characters into position from the given direction.", description="pour | Pours the characters into position from the given direction.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects pour --pour-direction down --movement-speed 0.2 --gap 1 --starting-color FFFFFF --final-gradient-stops 8A008A 00D1FF FFFFFF --easing IN_QUAD""", ) @dataclass @@ -1914,73 +2531,73 @@

    pour_speed: int = ArgField( cmd_name="--pour-speed", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=1, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of characters poured in per tick. Increase to speed up the effect.", ) # type: ignore[assignment] "int : Number of characters poured in per tick. Increase to speed up the effect." movement_speed: float = ArgField( cmd_name="--movement-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.2, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Movement speed of the characters. ", ) # type: ignore[assignment] "float : Movement speed of the characters." gap: int = ArgField( cmd_name="--gap", - type_parser=arg_validators.NonNegativeInt.type_parser, + type_parser=argvalidators.NonNegativeInt.type_parser, default=1, - metavar=arg_validators.NonNegativeInt.METAVAR, + metavar=argvalidators.NonNegativeInt.METAVAR, help="Number of frames to wait between each character in the pour effect. Increase to slow down effect and create a more defined back and forth motion.", ) # type: ignore[assignment] "int : Number of frames to wait between each character in the pour effect." starting_color: graphics.Color = ArgField( cmd_name=["--starting-color"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, default="ffffff", - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Color of the characters before the gradient starts.", ) # type: ignore[assignment] "graphics.Color : Color of the characters before the gradient starts." final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("8A008A", "00D1FF", "FFFFFF"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Space separated, unquoted, list of colors for the character gradient. If only one color is provided, the characters will be displayed in that color.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the character gradient." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name=["--final-gradient-steps"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use." final_gradient_frames: int = ArgField( cmd_name=["--final-gradient-frames"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=10, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of frames to display each gradient step.", ) # type: ignore[assignment] "int : Number of frames to display each gradient step." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." @@ -1988,7 +2605,7 @@

    movement_easing: easing.EasingFunction = ArgField( cmd_name="--movement-easing", default=easing.in_quad, - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, help="Easing function to use for character movement.", ) # type: ignore[assignment] "easing.EasingFunction : Easing function to use for character movement." @@ -2014,7 +2631,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -2036,7 +2653,7 @@

    - final_gradient_frames: int = ArgField(cmd_name=['--final-gradient-frames'], type_parser=arg_validators.PositiveInt.type_parser, default=10, metavar=arg_validators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') + final_gradient_frames: int = ArgField(cmd_name=['--final-gradient-frames'], type_parser=argvalidators.PositiveInt.type_parser, default=10, metavar=argvalidators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') class-attribute @@ -2058,7 +2675,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2080,7 +2697,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the character gradient. If only one color is provided, the characters will be displayed in that color.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the character gradient. If only one color is provided, the characters will be displayed in that color.') class-attribute @@ -2102,7 +2719,7 @@

    - gap: int = ArgField(cmd_name='--gap', type_parser=arg_validators.NonNegativeInt.type_parser, default=1, metavar=arg_validators.NonNegativeInt.METAVAR, help='Number of frames to wait between each character in the pour effect. Increase to slow down effect and create a more defined back and forth motion.') + gap: int = ArgField(cmd_name='--gap', type_parser=argvalidators.NonNegativeInt.type_parser, default=1, metavar=argvalidators.NonNegativeInt.METAVAR, help='Number of frames to wait between each character in the pour effect. Increase to slow down effect and create a more defined back and forth motion.') class-attribute @@ -2124,7 +2741,7 @@

    - movement_easing: easing.EasingFunction = ArgField(cmd_name='--movement-easing', default=easing.in_quad, type_parser=arg_validators.Ease.type_parser, help='Easing function to use for character movement.') + movement_easing: easing.EasingFunction = ArgField(cmd_name='--movement-easing', default=easing.in_quad, type_parser=argvalidators.Ease.type_parser, help='Easing function to use for character movement.') class-attribute @@ -2146,7 +2763,7 @@

    - movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=0.2, metavar=arg_validators.PositiveFloat.METAVAR, help='Movement speed of the characters. ') + movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=0.2, metavar=argvalidators.PositiveFloat.METAVAR, help='Movement speed of the characters. ') class-attribute @@ -2190,7 +2807,7 @@

    - pour_speed: int = ArgField(cmd_name='--pour-speed', type_parser=arg_validators.PositiveInt.type_parser, default=1, metavar=arg_validators.PositiveInt.METAVAR, help='Number of characters poured in per tick. Increase to speed up the effect.') + pour_speed: int = ArgField(cmd_name='--pour-speed', type_parser=argvalidators.PositiveInt.type_parser, default=1, metavar=argvalidators.PositiveInt.METAVAR, help='Number of characters poured in per tick. Increase to speed up the effect.') class-attribute @@ -2212,7 +2829,7 @@

    - starting_color: graphics.Color = ArgField(cmd_name=['--starting-color'], type_parser=arg_validators.Color.type_parser, default='ffffff', metavar=arg_validators.Color.METAVAR, help='Color of the characters before the gradient starts.') + starting_color: graphics.Color = ArgField(cmd_name=['--starting-color'], type_parser=argvalidators.ColorArg.type_parser, default='ffffff', metavar=argvalidators.ColorArg.METAVAR, help='Color of the characters before the gradient starts.') class-attribute diff --git a/effects/print/index.html b/effects/print/index.html index e8f4ac8a..5a66de00 100755 --- a/effects/print/index.html +++ b/effects/print/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1381,7 +1998,7 @@

    - Bases: BaseEffect[PrintConfig]

    + Bases: BaseEffect[PrintConfig]

    Prints the input data one line at at time with a carriage return and line feed.

    @@ -1563,7 +2180,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Print effect.

    @@ -1605,7 +2222,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1732,7 +2349,7 @@

    name="print", help="Lines are printed one at a time following a print head. Print head performs line feed, carriage return.", description="print | Lines are printed one at a time following a print head. Print head performs line feed, carriage return.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects print --final-gradient-stops 02b8bd c1f0e3 00ffa0 --final-gradient-steps 12 --print-head-return-speed 1.25 --print-speed 1 --print-head-easing IN_OUT_QUAD""", ) @@ -1750,47 +2367,47 @@

    final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("02b8bd", "c1f0e3", "00ffa0"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name=["--final-gradient-steps"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." print_head_return_speed: float = ArgField( cmd_name=["--print-head-return-speed"], - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=1.25, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Speed of the print head when performing a carriage return.", ) # type: ignore[assignment] "float : Speed of the print head when performing a carriage return." print_speed: int = ArgField( cmd_name=["--print-speed"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=1, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Speed of the print head when printing characters.", ) # type: ignore[assignment] "int : Speed of the print head when printing characters." @@ -1798,7 +2415,7 @@

    print_head_easing: easing.EasingFunction = ArgField( cmd_name=["--print-head-easing"], default=easing.in_out_quad, - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, help="Easing function to use for print head movement.", ) # type: ignore[assignment] "easing.EasingFunction : Easing function to use for print head movement." @@ -1824,7 +2441,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1846,7 +2463,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1868,7 +2485,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('02b8bd', 'c1f0e3', '00ffa0'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('02b8bd', 'c1f0e3', '00ffa0'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -1890,7 +2507,7 @@

    - print_head_easing: easing.EasingFunction = ArgField(cmd_name=['--print-head-easing'], default=easing.in_out_quad, type_parser=arg_validators.Ease.type_parser, help='Easing function to use for print head movement.') + print_head_easing: easing.EasingFunction = ArgField(cmd_name=['--print-head-easing'], default=easing.in_out_quad, type_parser=argvalidators.Ease.type_parser, help='Easing function to use for print head movement.') class-attribute @@ -1912,7 +2529,7 @@

    - print_head_return_speed: float = ArgField(cmd_name=['--print-head-return-speed'], type_parser=arg_validators.PositiveFloat.type_parser, default=1.25, metavar=arg_validators.PositiveFloat.METAVAR, help='Speed of the print head when performing a carriage return.') + print_head_return_speed: float = ArgField(cmd_name=['--print-head-return-speed'], type_parser=argvalidators.PositiveFloat.type_parser, default=1.25, metavar=argvalidators.PositiveFloat.METAVAR, help='Speed of the print head when performing a carriage return.') class-attribute @@ -1934,7 +2551,7 @@

    - print_speed: int = ArgField(cmd_name=['--print-speed'], type_parser=arg_validators.PositiveInt.type_parser, default=1, metavar=arg_validators.PositiveInt.METAVAR, help='Speed of the print head when printing characters.') + print_speed: int = ArgField(cmd_name=['--print-speed'], type_parser=argvalidators.PositiveInt.type_parser, default=1, metavar=argvalidators.PositiveInt.METAVAR, help='Speed of the print head when printing characters.') class-attribute diff --git a/effects/rain/index.html b/effects/rain/index.html index 89d1dea9..98cf4ad1 100755 --- a/effects/rain/index.html +++ b/effects/rain/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1399,7 +2016,7 @@

    - Bases: BaseEffect[RainConfig]

    + Bases: BaseEffect[RainConfig]

    Rain characters from the top of the output area.

    @@ -1581,7 +2198,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Rain effect.

    @@ -1656,7 +2273,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1773,7 +2390,7 @@

    name="rain", help="Rain characters from the top of the output area.", description="rain | Rain characters from the top of the output area.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects rain --rain-symbols o . , "*" "|" --rain-colors 00315C 004C8F 0075DB 3F91D9 78B9F2 9AC8F5 B8D8F8 E3EFFC --final-gradient-stops 488bff b2e7de 57eaf7 --final-gradient-steps 12 --movement-speed 0.1-0.2 --easing IN_QUART""", ) @dataclass @@ -1791,8 +2408,8 @@

    rain_colors: tuple[graphics.Color, ...] = ArgField( cmd_name=["--rain-colors"], - type_parser=arg_validators.Color.type_parser, - metavar=arg_validators.Color.METAVAR, + type_parser=argvalidators.ColorArg.type_parser, + metavar=argvalidators.ColorArg.METAVAR, nargs="+", default=("00315C", "004C8F", "0075DB", "3F91D9", "78B9F2", "9AC8F5", "B8D8F8", "E3EFFC"), help="List of colors for the rain drops. Colors are randomly chosen from the list.", @@ -1801,48 +2418,48 @@

    movement_speed: tuple[float, float] = ArgField( cmd_name="--movement-speed", - type_parser=arg_validators.PositiveFloatRange.type_parser, + type_parser=argvalidators.PositiveFloatRange.type_parser, default=(0.1, 0.2), - metavar=arg_validators.PositiveFloatRange.METAVAR, + metavar=argvalidators.PositiveFloatRange.METAVAR, help="Falling speed range of the rain drops.", ) # type: ignore[assignment] "tuple[float, float] : Falling speed range of the rain drops." rain_symbols: tuple[str, ...] = ArgField( cmd_name="--rain-symbols", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, nargs="+", default=("o", ".", ",", "*", "|"), - metavar=arg_validators.Symbol.METAVAR, + metavar=argvalidators.Symbol.METAVAR, help="Space separated list of symbols to use for the rain drops. Symbols are randomly chosen from the list.", ) # type: ignore[assignment] "tuple[str, ...] : Tuple of symbols to use for the rain drops. Symbols are randomly chosen from the tuple." final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name="--final-gradient-stops", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("488bff", "b2e7de", "57eaf7"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." @@ -1850,8 +2467,8 @@

    movement_easing: easing.EasingFunction = ArgField( cmd_name=["--movement-easing"], default=easing.in_quart, - type_parser=arg_validators.Ease.type_parser, - metavar=arg_validators.Ease.METAVAR, + type_parser=argvalidators.Ease.type_parser, + metavar=argvalidators.Ease.METAVAR, help="Easing function to use for character movement.", ) # type: ignore[assignment] "easing.EasingFunction : Easing function to use for character movement." @@ -1877,7 +2494,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1899,7 +2516,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1921,7 +2538,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=arg_validators.Color.type_parser, nargs='+', default=('488bff', 'b2e7de', '57eaf7'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('488bff', 'b2e7de', '57eaf7'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -1943,7 +2560,7 @@

    - movement_easing: easing.EasingFunction = ArgField(cmd_name=['--movement-easing'], default=easing.in_quart, type_parser=arg_validators.Ease.type_parser, metavar=arg_validators.Ease.METAVAR, help='Easing function to use for character movement.') + movement_easing: easing.EasingFunction = ArgField(cmd_name=['--movement-easing'], default=easing.in_quart, type_parser=argvalidators.Ease.type_parser, metavar=argvalidators.Ease.METAVAR, help='Easing function to use for character movement.') class-attribute @@ -1965,7 +2582,7 @@

    - movement_speed: tuple[float, float] = ArgField(cmd_name='--movement-speed', type_parser=arg_validators.PositiveFloatRange.type_parser, default=(0.1, 0.2), metavar=arg_validators.PositiveFloatRange.METAVAR, help='Falling speed range of the rain drops.') + movement_speed: tuple[float, float] = ArgField(cmd_name='--movement-speed', type_parser=argvalidators.PositiveFloatRange.type_parser, default=(0.1, 0.2), metavar=argvalidators.PositiveFloatRange.METAVAR, help='Falling speed range of the rain drops.') class-attribute @@ -1987,7 +2604,7 @@

    - rain_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--rain-colors'], type_parser=arg_validators.Color.type_parser, metavar=arg_validators.Color.METAVAR, nargs='+', default=('00315C', '004C8F', '0075DB', '3F91D9', '78B9F2', '9AC8F5', 'B8D8F8', 'E3EFFC'), help='List of colors for the rain drops. Colors are randomly chosen from the list.') + rain_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--rain-colors'], type_parser=argvalidators.ColorArg.type_parser, metavar=argvalidators.ColorArg.METAVAR, nargs='+', default=('00315C', '004C8F', '0075DB', '3F91D9', '78B9F2', '9AC8F5', 'B8D8F8', 'E3EFFC'), help='List of colors for the rain drops. Colors are randomly chosen from the list.') class-attribute @@ -2009,7 +2626,7 @@

    - rain_symbols: tuple[str, ...] = ArgField(cmd_name='--rain-symbols', type_parser=arg_validators.Symbol.type_parser, nargs='+', default=('o', '.', ',', '*', '|'), metavar=arg_validators.Symbol.METAVAR, help='Space separated list of symbols to use for the rain drops. Symbols are randomly chosen from the list.') + rain_symbols: tuple[str, ...] = ArgField(cmd_name='--rain-symbols', type_parser=argvalidators.Symbol.type_parser, nargs='+', default=('o', '.', ',', '*', '|'), metavar=argvalidators.Symbol.METAVAR, help='Space separated list of symbols to use for the rain drops. Symbols are randomly chosen from the list.') class-attribute diff --git a/effects/randomsequence/index.html b/effects/randomsequence/index.html index 8cb376a4..008b5eab 100755 --- a/effects/randomsequence/index.html +++ b/effects/randomsequence/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1381,7 +1998,7 @@

    - Bases: BaseEffect[RandomSequenceConfig]

    + Bases: BaseEffect[RandomSequenceConfig]

    Prints the input data in a random sequence, one character at a time.

    @@ -1563,7 +2180,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the RandomSequence effect.

    @@ -1627,7 +2244,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1750,56 +2367,56 @@

    starting_color: graphics.Color = ArgField( cmd_name=["--starting-color"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, default="000000", - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Color of the characters at spawn.", ) # type: ignore[assignment] "graphics.Color : Color of the characters at spawn." final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("8A008A", "00D1FF", "FFFFFF"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name=["--final-gradient-steps"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_frames: int = ArgField( cmd_name=["--final-gradient-frames"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=12, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of frames to display each gradient step.", ) # type: ignore[assignment] "int : Number of frames to display each gradient step." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." speed: float = ArgField( cmd_name=["--speed"], - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.004, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Speed of the animation as a percentage of the total number of characters to reveal in each tick.", ) # type: ignore[assignment] @@ -1826,7 +2443,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1848,7 +2465,7 @@

    - final_gradient_frames: int = ArgField(cmd_name=['--final-gradient-frames'], type_parser=arg_validators.PositiveInt.type_parser, default=12, metavar=arg_validators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') + final_gradient_frames: int = ArgField(cmd_name=['--final-gradient-frames'], type_parser=argvalidators.PositiveInt.type_parser, default=12, metavar=argvalidators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') class-attribute @@ -1870,7 +2487,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1892,7 +2509,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -1914,7 +2531,7 @@

    - speed: float = ArgField(cmd_name=['--speed'], type_parser=arg_validators.PositiveFloat.type_parser, default=0.004, metavar=arg_validators.PositiveFloat.METAVAR, help='Speed of the animation as a percentage of the total number of characters to reveal in each tick.') + speed: float = ArgField(cmd_name=['--speed'], type_parser=argvalidators.PositiveFloat.type_parser, default=0.004, metavar=argvalidators.PositiveFloat.METAVAR, help='Speed of the animation as a percentage of the total number of characters to reveal in each tick.') class-attribute @@ -1936,7 +2553,7 @@

    - starting_color: graphics.Color = ArgField(cmd_name=['--starting-color'], type_parser=arg_validators.Color.type_parser, default='000000', metavar=arg_validators.Color.METAVAR, help='Color of the characters at spawn.') + starting_color: graphics.Color = ArgField(cmd_name=['--starting-color'], type_parser=argvalidators.ColorArg.type_parser, default='000000', metavar=argvalidators.ColorArg.METAVAR, help='Color of the characters at spawn.') class-attribute diff --git a/effects/rings/index.html b/effects/rings/index.html index b42480ae..c955d041 100755 --- a/effects/rings/index.html +++ b/effects/rings/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1435,7 +2052,7 @@

    - Bases: BaseEffect[RingsConfig]

    + Bases: BaseEffect[RingsConfig]

    Characters are dispersed and form into spinning rings.

    @@ -1479,8 +2096,7 @@

    Source code in terminaltexteffects/effects/effect_rings.py -
    382
    -383
    +              
    383
     384
     385
     386
    @@ -1495,23 +2111,24 @@ 

    395 396 397 -398

    class Rings(BaseEffect[RingsConfig]):
    -    """Characters are dispersed and form into spinning rings.
    -
    -    Attributes:
    -        effect_config (RingsConfig): Configuration for the effect.
    -        terminal_config (TerminalConfig): Configuration for the terminal.
    -    """
    -
    -    _config_cls = RingsConfig
    -    _iterator_cls = RingsIterator
    -
    -    def __init__(self, input_data: str) -> None:
    -        """Initialize the effect with the provided input data.
    -
    -        Args:
    -            input_data (str): The input data to use for the effect."""
    -        super().__init__(input_data)
    +398
    +399
    class Rings(BaseEffect[RingsConfig]):
    +    """Characters are dispersed and form into spinning rings.
    +
    +    Attributes:
    +        effect_config (RingsConfig): Configuration for the effect.
    +        terminal_config (TerminalConfig): Configuration for the terminal.
    +    """
    +
    +    _config_cls = RingsConfig
    +    _iterator_cls = RingsIterator
    +
    +    def __init__(self, input_data: str) -> None:
    +        """Initialize the effect with the provided input data.
    +
    +        Args:
    +            input_data (str): The input data to use for the effect."""
    +        super().__init__(input_data)
     
    @@ -1574,17 +2191,17 @@

    Source code in terminaltexteffects/effects/effect_rings.py -
    393
    -394
    +            
    def __init__(self, input_data: str) -> None:
    -    """Initialize the effect with the provided input data.
    -
    -    Args:
    -        input_data (str): The input data to use for the effect."""
    -    super().__init__(input_data)
    +398
    +399
    def __init__(self, input_data: str) -> None:
    +    """Initialize the effect with the provided input data.
    +
    +    Args:
    +        input_data (str): The input data to use for the effect."""
    +    super().__init__(input_data)
     
    @@ -1617,7 +2234,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configurations for the RingsEffect.

    @@ -1670,7 +2287,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1738,8 +2355,7 @@

    Source code in terminaltexteffects/effects/effect_rings.py -
     25
    - 26
    +              
     26
      27
      28
      29
    @@ -1850,119 +2466,120 @@ 

    134 135 136 -137

    @argclass(
    -    name="rings",
    -    help="Characters are dispersed and form into spinning rings.",
    -    description="rings | Characters are dispersed and form into spinning rings.",
    -    epilog="""Example: terminaltexteffects rings --ring-colors ab48ff e7b2b2 fffebd --final-gradient-stops ab48ff e7b2b2 fffebd --final-gradient-steps 12 --ring-gap 0.1 --spin-duration 200 --spin-speed 0.25-1.0 --disperse-duration 200 --spin-disperse-cycles 3""",
    -)
    -@dataclass
    -class RingsConfig(ArgsDataClass):
    -    """Configurations for the RingsEffect.
    -
    -    Attributes:
    -        ring_colors (tuple[graphics.Color, ...]): Tuple of colors for the rings.
    -        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    -        final_gradient_steps (tuple[int, ...]): Number of gradient steps to use. More steps will create a smoother and longer gradient animation.
    -        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient.
    -        ring_gap (float): Distance between rings as a percent of the smallest output area dimension. Valid values are 0 < n <= 1.
    -        spin_duration (int): Number of frames for each cycle of the spin phase. Valid values are n >= 0.
    -        spin_speed (tuple[float, float]): Range of speeds for the rotation of the rings. The speed is randomly selected from this range for each ring. Valid values are n > 0.
    -        disperse_duration (int): Number of frames spent in the dispersed state between spinning cycles. Valid values are n >= 0.
    -        spin_disperse_cycles (int): Number of times the animation will cycle between spinning rings and dispersed characters. Valid values are n > 0.
    -    """
    -
    -    ring_colors: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--ring-colors"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("ab48ff", "e7b2b2", "fffebd"),
    -        metavar=arg_validators.Color.METAVAR,
    -        help="Space separated, unquoted, list of colors for the rings.",
    -    )  # type: ignore[assignment]
    -
    -    "tuple[graphics.Color] : Tuple of colors for the rings."
    -
    -    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--final-gradient-stops"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("ab48ff", "e7b2b2", "fffebd"),
    -        metavar=arg_validators.Color.METAVAR,
    -        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.",
    -    )  # type: ignore[assignment]
    -
    -    "tuple[graphics.Color] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    -
    -    final_gradient_steps: tuple[int, ...] = ArgField(
    -        cmd_name=["--final-gradient-steps"],
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        nargs="+",
    -        default=(12,),
    -        metavar=arg_validators.PositiveInt.METAVAR,
    -        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    -    )  # type: ignore[assignment]
    -
    -    "tuple[int, ...] : Number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    -
    -    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    -        cmd_name="--final-gradient-direction",
    -        type_parser=arg_validators.GradientDirection.type_parser,
    -        default=graphics.Gradient.Direction.VERTICAL,
    -        metavar=arg_validators.GradientDirection.METAVAR,
    -        help="Direction of the final gradient.",
    -    )  # type: ignore[assignment]
    -
    -    "graphics.Gradient.Direction : Direction of the final gradient."
    -
    -    ring_gap: float = ArgField(
    -        cmd_name=["--ring-gap"],
    -        type_parser=arg_validators.PositiveFloat.type_parser,
    -        default=0.1,
    -        help="Distance between rings as a percent of the smallest output area dimension.",
    -    )  # type: ignore[assignment]
    -
    -    "float : Distance between rings as a percent of the smallest output area dimension."
    -    spin_duration: int = ArgField(
    -        cmd_name=["--spin-duration"],
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        default=200,
    -        help="Number of frames for each cycle of the spin phase.",
    -    )  # type: ignore[assignment]
    -
    -    "int : Number of frames for each cycle of the spin phase."
    -
    -    spin_speed: tuple[float, float] = ArgField(
    -        cmd_name=["--spin-speed"],
    -        type_parser=arg_validators.PositiveFloatRange.type_parser,
    -        default=(0.25, 1.0),
    -        metavar=arg_validators.PositiveFloatRange.METAVAR,
    -        help="Range of speeds for the rotation of the rings. The speed is randomly selected from this range for each ring.",
    -    )  # type: ignore[assignment]
    -
    -    "tuple[float, float] : Range of speeds for the rotation of the rings. The speed is randomly selected from this range for each ring."
    -
    -    disperse_duration: int = ArgField(
    -        cmd_name=["--disperse-duration"],
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        default=200,
    -        help="Number of frames spent in the dispersed state between spinning cycles.",
    -    )  # type: ignore[assignment]
    -
    -    "int : Number of frames spent in the dispersed state between spinning cycles."
    -
    -    spin_disperse_cycles: int = ArgField(
    -        cmd_name=["--spin-disperse-cycles"],
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        default=3,
    -        help="Number of times the animation will cycles between spinning rings and dispersed characters.",
    -    )  # type: ignore[assignment]
    -
    -    "int : Number of times the animation will cycles between spinning rings and dispersed characters."
    -
    -    @classmethod
    -    def get_effect_class(cls):
    -        return Rings
    +137
    +138
    @argclass(
    +    name="rings",
    +    help="Characters are dispersed and form into spinning rings.",
    +    description="rings | Characters are dispersed and form into spinning rings.",
    +    epilog="""Example: terminaltexteffects rings --ring-colors ab48ff e7b2b2 fffebd --final-gradient-stops ab48ff e7b2b2 fffebd --final-gradient-steps 12 --ring-gap 0.1 --spin-duration 200 --spin-speed 0.25-1.0 --disperse-duration 200 --spin-disperse-cycles 3""",
    +)
    +@dataclass
    +class RingsConfig(ArgsDataClass):
    +    """Configurations for the RingsEffect.
    +
    +    Attributes:
    +        ring_colors (tuple[graphics.Color, ...]): Tuple of colors for the rings.
    +        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    +        final_gradient_steps (tuple[int, ...]): Number of gradient steps to use. More steps will create a smoother and longer gradient animation.
    +        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient.
    +        ring_gap (float): Distance between rings as a percent of the smallest output area dimension. Valid values are 0 < n <= 1.
    +        spin_duration (int): Number of frames for each cycle of the spin phase. Valid values are n >= 0.
    +        spin_speed (tuple[float, float]): Range of speeds for the rotation of the rings. The speed is randomly selected from this range for each ring. Valid values are n > 0.
    +        disperse_duration (int): Number of frames spent in the dispersed state between spinning cycles. Valid values are n >= 0.
    +        spin_disperse_cycles (int): Number of times the animation will cycle between spinning rings and dispersed characters. Valid values are n > 0.
    +    """
    +
    +    ring_colors: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--ring-colors"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("ab48ff", "e7b2b2", "fffebd"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        help="Space separated, unquoted, list of colors for the rings.",
    +    )  # type: ignore[assignment]
    +
    +    "tuple[graphics.Color] : Tuple of colors for the rings."
    +
    +    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--final-gradient-stops"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("ab48ff", "e7b2b2", "fffebd"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        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.",
    +    )  # type: ignore[assignment]
    +
    +    "tuple[graphics.Color] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    +
    +    final_gradient_steps: tuple[int, ...] = ArgField(
    +        cmd_name=["--final-gradient-steps"],
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        nargs="+",
    +        default=(12,),
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    +    )  # type: ignore[assignment]
    +
    +    "tuple[int, ...] : Number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    +
    +    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    +        cmd_name="--final-gradient-direction",
    +        type_parser=argvalidators.GradientDirection.type_parser,
    +        default=graphics.Gradient.Direction.VERTICAL,
    +        metavar=argvalidators.GradientDirection.METAVAR,
    +        help="Direction of the final gradient.",
    +    )  # type: ignore[assignment]
    +
    +    "graphics.Gradient.Direction : Direction of the final gradient."
    +
    +    ring_gap: float = ArgField(
    +        cmd_name=["--ring-gap"],
    +        type_parser=argvalidators.PositiveFloat.type_parser,
    +        default=0.1,
    +        help="Distance between rings as a percent of the smallest output area dimension.",
    +    )  # type: ignore[assignment]
    +
    +    "float : Distance between rings as a percent of the smallest output area dimension."
    +    spin_duration: int = ArgField(
    +        cmd_name=["--spin-duration"],
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        default=200,
    +        help="Number of frames for each cycle of the spin phase.",
    +    )  # type: ignore[assignment]
    +
    +    "int : Number of frames for each cycle of the spin phase."
    +
    +    spin_speed: tuple[float, float] = ArgField(
    +        cmd_name=["--spin-speed"],
    +        type_parser=argvalidators.PositiveFloatRange.type_parser,
    +        default=(0.25, 1.0),
    +        metavar=argvalidators.PositiveFloatRange.METAVAR,
    +        help="Range of speeds for the rotation of the rings. The speed is randomly selected from this range for each ring.",
    +    )  # type: ignore[assignment]
    +
    +    "tuple[float, float] : Range of speeds for the rotation of the rings. The speed is randomly selected from this range for each ring."
    +
    +    disperse_duration: int = ArgField(
    +        cmd_name=["--disperse-duration"],
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        default=200,
    +        help="Number of frames spent in the dispersed state between spinning cycles.",
    +    )  # type: ignore[assignment]
    +
    +    "int : Number of frames spent in the dispersed state between spinning cycles."
    +
    +    spin_disperse_cycles: int = ArgField(
    +        cmd_name=["--spin-disperse-cycles"],
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        default=3,
    +        help="Number of times the animation will cycles between spinning rings and dispersed characters.",
    +    )  # type: ignore[assignment]
    +
    +    "int : Number of times the animation will cycles between spinning rings and dispersed characters."
    +
    +    @classmethod
    +    def get_effect_class(cls):
    +        return Rings
     
    @@ -1981,7 +2598,7 @@

    - disperse_duration: int = ArgField(cmd_name=['--disperse-duration'], type_parser=arg_validators.PositiveInt.type_parser, default=200, help='Number of frames spent in the dispersed state between spinning cycles.') + disperse_duration: int = ArgField(cmd_name=['--disperse-duration'], type_parser=argvalidators.PositiveInt.type_parser, default=200, help='Number of frames spent in the dispersed state between spinning cycles.') class-attribute @@ -2003,7 +2620,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -2025,7 +2642,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2047,7 +2664,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('ab48ff', 'e7b2b2', 'fffebd'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('ab48ff', 'e7b2b2', 'fffebd'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2069,7 +2686,7 @@

    - ring_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--ring-colors'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('ab48ff', 'e7b2b2', 'fffebd'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the rings.') + ring_colors: tuple[graphics.Color, ...] = ArgField(cmd_name=['--ring-colors'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('ab48ff', 'e7b2b2', 'fffebd'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the rings.') class-attribute @@ -2091,7 +2708,7 @@

    - ring_gap: float = ArgField(cmd_name=['--ring-gap'], type_parser=arg_validators.PositiveFloat.type_parser, default=0.1, help='Distance between rings as a percent of the smallest output area dimension.') + ring_gap: float = ArgField(cmd_name=['--ring-gap'], type_parser=argvalidators.PositiveFloat.type_parser, default=0.1, help='Distance between rings as a percent of the smallest output area dimension.') class-attribute @@ -2113,7 +2730,7 @@

    - spin_disperse_cycles: int = ArgField(cmd_name=['--spin-disperse-cycles'], type_parser=arg_validators.PositiveInt.type_parser, default=3, help='Number of times the animation will cycles between spinning rings and dispersed characters.') + spin_disperse_cycles: int = ArgField(cmd_name=['--spin-disperse-cycles'], type_parser=argvalidators.PositiveInt.type_parser, default=3, help='Number of times the animation will cycles between spinning rings and dispersed characters.') class-attribute @@ -2135,7 +2752,7 @@

    - spin_duration: int = ArgField(cmd_name=['--spin-duration'], type_parser=arg_validators.PositiveInt.type_parser, default=200, help='Number of frames for each cycle of the spin phase.') + spin_duration: int = ArgField(cmd_name=['--spin-duration'], type_parser=argvalidators.PositiveInt.type_parser, default=200, help='Number of frames for each cycle of the spin phase.') class-attribute @@ -2157,7 +2774,7 @@

    - spin_speed: tuple[float, float] = ArgField(cmd_name=['--spin-speed'], type_parser=arg_validators.PositiveFloatRange.type_parser, default=(0.25, 1.0), metavar=arg_validators.PositiveFloatRange.METAVAR, help='Range of speeds for the rotation of the rings. The speed is randomly selected from this range for each ring.') + spin_speed: tuple[float, float] = ArgField(cmd_name=['--spin-speed'], type_parser=argvalidators.PositiveFloatRange.type_parser, default=(0.25, 1.0), metavar=argvalidators.PositiveFloatRange.METAVAR, help='Range of speeds for the rotation of the rings. The speed is randomly selected from this range for each ring.') class-attribute diff --git a/effects/scattered/index.html b/effects/scattered/index.html index 75af150b..dd25cec4 100755 --- a/effects/scattered/index.html +++ b/effects/scattered/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1381,7 +1998,7 @@

    - Bases: BaseEffect[ScatteredConfig]

    + Bases: BaseEffect[ScatteredConfig]

    Text is scattered across the output area and moves into position.

    @@ -1563,7 +2180,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the effect.

    @@ -1616,7 +2233,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1730,7 +2347,7 @@

    name="scattered", help="Text is scattered across the output area and moves into position.", description="scattered | Text is scattered across the output area and moves into position.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects scattered --final-gradient-stops ff9048 ab9dff bdffea --final-gradient-steps 12 --final-gradient-frames 12 --movement-speed 0.5 --movement-easing IN_OUT_BACK""", ) @dataclass @@ -1747,46 +2364,46 @@

    final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("ff9048", "ab9dff", "bdffea"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Space separated, unquoted, list of colors for the character gradient. If only one color is provided, the characters will be displayed in that color.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the character gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_frames: int = ArgField( cmd_name="--final-gradient-frames", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=12, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of frames to display each gradient step.", ) # type: ignore[assignment] "int : Number of frames to display each gradient step." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." movement_speed: float = ArgField( cmd_name="--movement-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.3, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Movement speed of the characters. ", ) # type: ignore[assignment] "float : Movement speed of the characters. " @@ -1794,7 +2411,7 @@

    movement_easing: easing.EasingFunction = ArgField( cmd_name="--movement-easing", default=easing.in_out_back, - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, help="Easing function to use for character movement.", ) # type: ignore[assignment] "easing.EasingFunction : Easing function to use for character movement." @@ -1820,7 +2437,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1842,7 +2459,7 @@

    - final_gradient_frames: int = ArgField(cmd_name='--final-gradient-frames', type_parser=arg_validators.PositiveInt.type_parser, default=12, metavar=arg_validators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') + final_gradient_frames: int = ArgField(cmd_name='--final-gradient-frames', type_parser=argvalidators.PositiveInt.type_parser, default=12, metavar=argvalidators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') class-attribute @@ -1864,7 +2481,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1886,7 +2503,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('ff9048', 'ab9dff', 'bdffea'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the character gradient. If only one color is provided, the characters will be displayed in that color.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('ff9048', 'ab9dff', 'bdffea'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the character gradient. If only one color is provided, the characters will be displayed in that color.') class-attribute @@ -1908,7 +2525,7 @@

    - movement_easing: easing.EasingFunction = ArgField(cmd_name='--movement-easing', default=easing.in_out_back, type_parser=arg_validators.Ease.type_parser, help='Easing function to use for character movement.') + movement_easing: easing.EasingFunction = ArgField(cmd_name='--movement-easing', default=easing.in_out_back, type_parser=argvalidators.Ease.type_parser, help='Easing function to use for character movement.') class-attribute @@ -1930,7 +2547,7 @@

    - movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=0.3, metavar=arg_validators.PositiveFloat.METAVAR, help='Movement speed of the characters. ') + movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=0.3, metavar=argvalidators.PositiveFloat.METAVAR, help='Movement speed of the characters. ') class-attribute diff --git a/effects/slide/index.html b/effects/slide/index.html index 37dcd321..9024dfcf 100755 --- a/effects/slide/index.html +++ b/effects/slide/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1453,7 +2070,7 @@

    - Bases: BaseEffect[SlideConfig]

    + Bases: BaseEffect[SlideConfig]

    Slides characters into view from outside the terminal.

    @@ -1635,7 +2252,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Slide effect.

    @@ -1710,7 +2327,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1869,7 +2486,7 @@

    name="slide", help="Slide characters into view from outside the terminal.", description="slide | Slide characters into view from outside the terminal, grouped by row, column, or diagonal.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects slide --movement-speed 0.5 --grouping row --final-gradient-stops 833ab4 fd1d1d fcb045 --final-gradient-steps 12 --final-gradient-frames 10 --final-gradient-direction vertical --gap 3 --reverse-direction --merge --movement-easing OUT_QUAD""", ) @dataclass @@ -1889,9 +2506,9 @@

    movement_speed: float = ArgField( cmd_name="--movement-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.5, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Speed of the characters.", ) # type: ignore[assignment] "float : Speed of the characters." @@ -1906,28 +2523,28 @@

    final_gradient_stops: tuple[int | str, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("833ab4", "fd1d1d", "fcb045"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Space separated, unquoted, list of colors for the character gradient. If only one color is provided, the characters will be displayed in that color.", ) # type: ignore[assignment] "tuple[int | str, ...] : Tuple of colors for the character gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_frames: int = ArgField( cmd_name="--final-gradient-frames", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=10, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of frames to display each gradient step.", ) # type: ignore[assignment] "int : Number of frames to display each gradient step." @@ -1935,16 +2552,16 @@

    final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", default=graphics.Gradient.Direction.VERTICAL, - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, help="Direction of the gradient (vertical, horizontal, diagonal, center).", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the gradient." gap: int = ArgField( cmd_name="--gap", - type_parser=arg_validators.NonNegativeInt.type_parser, + type_parser=argvalidators.NonNegativeInt.type_parser, default=3, - metavar=arg_validators.NonNegativeInt.METAVAR, + metavar=argvalidators.NonNegativeInt.METAVAR, help="Number of frames to wait before adding the next group of characters. Increasing this value creates a more staggered effect.", ) # type: ignore[assignment] "int : Number of frames to wait before adding the next group of characters. Increasing this value creates a more staggered effect." @@ -1966,8 +2583,8 @@

    movement_easing: easing.EasingFunction = ArgField( cmd_name=["--movement-easing"], default=easing.in_out_quad, - type_parser=arg_validators.Ease.type_parser, - metavar=arg_validators.Ease.METAVAR, + type_parser=argvalidators.Ease.type_parser, + metavar=argvalidators.Ease.METAVAR, help="Easing function to use for character movement.", ) # type: ignore[assignment] "easing.EasingFunction : Easing function to use for character movement." @@ -1993,7 +2610,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', default=graphics.Gradient.Direction.VERTICAL, type_parser=arg_validators.GradientDirection.type_parser, help='Direction of the gradient (vertical, horizontal, diagonal, center).') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', default=graphics.Gradient.Direction.VERTICAL, type_parser=argvalidators.GradientDirection.type_parser, help='Direction of the gradient (vertical, horizontal, diagonal, center).') class-attribute @@ -2015,7 +2632,7 @@

    - final_gradient_frames: int = ArgField(cmd_name='--final-gradient-frames', type_parser=arg_validators.PositiveInt.type_parser, default=10, metavar=arg_validators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') + final_gradient_frames: int = ArgField(cmd_name='--final-gradient-frames', type_parser=argvalidators.PositiveInt.type_parser, default=10, metavar=argvalidators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') class-attribute @@ -2037,7 +2654,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2059,7 +2676,7 @@

    - final_gradient_stops: tuple[int | str, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('833ab4', 'fd1d1d', 'fcb045'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the character gradient. If only one color is provided, the characters will be displayed in that color.') + final_gradient_stops: tuple[int | str, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('833ab4', 'fd1d1d', 'fcb045'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the character gradient. If only one color is provided, the characters will be displayed in that color.') class-attribute @@ -2081,7 +2698,7 @@

    - gap: int = ArgField(cmd_name='--gap', type_parser=arg_validators.NonNegativeInt.type_parser, default=3, metavar=arg_validators.NonNegativeInt.METAVAR, help='Number of frames to wait before adding the next group of characters. Increasing this value creates a more staggered effect.') + gap: int = ArgField(cmd_name='--gap', type_parser=argvalidators.NonNegativeInt.type_parser, default=3, metavar=argvalidators.NonNegativeInt.METAVAR, help='Number of frames to wait before adding the next group of characters. Increasing this value creates a more staggered effect.') class-attribute @@ -2147,7 +2764,7 @@

    - movement_easing: easing.EasingFunction = ArgField(cmd_name=['--movement-easing'], default=easing.in_out_quad, type_parser=arg_validators.Ease.type_parser, metavar=arg_validators.Ease.METAVAR, help='Easing function to use for character movement.') + movement_easing: easing.EasingFunction = ArgField(cmd_name=['--movement-easing'], default=easing.in_out_quad, type_parser=argvalidators.Ease.type_parser, metavar=argvalidators.Ease.METAVAR, help='Easing function to use for character movement.') class-attribute @@ -2169,7 +2786,7 @@

    - movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=0.5, metavar=arg_validators.PositiveFloat.METAVAR, help='Speed of the characters.') + movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=0.5, metavar=argvalidators.PositiveFloat.METAVAR, help='Speed of the characters.') class-attribute diff --git a/effects/spotlights/index.html b/effects/spotlights/index.html index 11b727aa..c273d26a 100755 --- a/effects/spotlights/index.html +++ b/effects/spotlights/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1417,7 +2034,7 @@

    - Bases: BaseEffect[SpotlightsConfig]

    + Bases: BaseEffect[SpotlightsConfig]

    Spotlights search the text area, illuminating characters, before converging in the center and expanding.

    @@ -1461,8 +2078,7 @@

    Source code in terminaltexteffects/effects/effect_spotlights.py -
    266
    -267
    +              
    267
     268
     269
     270
    @@ -1477,23 +2093,24 @@ 

    279 280 281 -282

    class Spotlights(BaseEffect[SpotlightsConfig]):
    -    """Spotlights search the text area, illuminating characters, before converging in the center and expanding.
    -
    -    Attributes:
    -        effect_config (SpotlightsConfig): Configuration for the effect.
    -        terminal_config (TerminalConfig): Configuration for the terminal.
    -    """
    -
    -    _config_cls = SpotlightsConfig
    -    _iterator_cls = SpotlightsIterator
    -
    -    def __init__(self, input_data: str) -> None:
    -        """Initialize the effect with the provided input data.
    -
    -        Args:
    -            input_data (str): The input data to use for the effect."""
    -        super().__init__(input_data)
    +282
    +283
    class Spotlights(BaseEffect[SpotlightsConfig]):
    +    """Spotlights search the text area, illuminating characters, before converging in the center and expanding.
    +
    +    Attributes:
    +        effect_config (SpotlightsConfig): Configuration for the effect.
    +        terminal_config (TerminalConfig): Configuration for the terminal.
    +    """
    +
    +    _config_cls = SpotlightsConfig
    +    _iterator_cls = SpotlightsIterator
    +
    +    def __init__(self, input_data: str) -> None:
    +        """Initialize the effect with the provided input data.
    +
    +        Args:
    +            input_data (str): The input data to use for the effect."""
    +        super().__init__(input_data)
     
    @@ -1556,17 +2173,17 @@

    Source code in terminaltexteffects/effects/effect_spotlights.py -
    277
    -278
    +            
    def __init__(self, input_data: str) -> None:
    -    """Initialize the effect with the provided input data.
    -
    -    Args:
    -        input_data (str): The input data to use for the effect."""
    -    super().__init__(input_data)
    +282
    +283
    def __init__(self, input_data: str) -> None:
    +    """Initialize the effect with the provided input data.
    +
    +    Args:
    +        input_data (str): The input data to use for the effect."""
    +    super().__init__(input_data)
     
    @@ -1599,7 +2216,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Spotlights effect.

    @@ -1641,7 +2258,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1709,8 +2326,7 @@

    Source code in terminaltexteffects/effects/effect_spotlights.py -
     25
    - 26
    +              
     26
      27
      28
      29
    @@ -1807,105 +2423,106 @@ 

    120 121 122 -123

    @argclass(
    -    name="spotlights",
    -    help="Spotlights search the text area, illuminating characters, before converging in the center and expanding.",
    -    description="spotlights | Spotlights search the text area, illuminating characters, before converging in the center and expanding.",
    -    epilog=f"""{arg_validators.EASING_EPILOG}
    -Example: terminaltexteffects spotlights --final-gradient-stops ab48ff e7b2b2 fffebd --final-gradient-steps 12 --beam-width-ratio 2.0 --beam-falloff 0.3 --search-duration 750 --search-speed-range 0.25-0.5 --spotlight-count 3""",
    -)
    -@dataclass
    -class SpotlightsConfig(ArgsDataClass):
    -    """Configuration for the Spotlights effect.
    -
    -    Attributes:
    -        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    -        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    -        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient.
    -        beam_width_ratio (float): Width of the beam of light as min(width, height) // n of the input text. Valid values are n > 0.
    -        beam_falloff (float): Distance from the edge of the beam where the brightness begins to fall off, as a percentage of total beam width. Valid values are 0 <= n <= 1.
    -        search_duration (int): Duration of the search phase, in frames, before the spotlights converge in the center. Valid values are n > 0.
    -        search_speed_range (tuple[float, float]): Range of speeds for the spotlights during the search phase. The speed is a random value between the two provided values. Valid values are n > 0.
    -        spotlight_count (int): Number of spotlights to use. Valid values are n > 0.
    -    """
    -
    -    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--final-gradient-stops"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("ab48ff", "e7b2b2", "fffebd"),
    -        metavar=arg_validators.Color.METAVAR,
    -        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.",
    -    )  # type: ignore[assignment]
    -    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    -
    -    final_gradient_steps: tuple[int, ...] = ArgField(
    -        cmd_name="--final-gradient-steps",
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        nargs="+",
    -        default=(12,),
    -        metavar=arg_validators.PositiveInt.METAVAR,
    -        help="Number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    -    )  # type: ignore[assignment]
    -    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    -
    -    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    -        cmd_name="--final-gradient-direction",
    -        type_parser=arg_validators.GradientDirection.type_parser,
    -        default=graphics.Gradient.Direction.VERTICAL,
    -        metavar=arg_validators.GradientDirection.METAVAR,
    -        help="Direction of the final gradient.",
    -    )  # type: ignore[assignment]
    -    "graphics.Gradient.Direction : Direction of the final gradient."
    -
    -    beam_width_ratio: float = ArgField(
    -        cmd_name="--beam-width-ratio",
    -        type_parser=arg_validators.PositiveFloat.type_parser,
    -        default=2.0,
    -        metavar=arg_validators.PositiveFloat.METAVAR,
    -        help="Width of the beam of light as min(width, height) // n of the input text.",
    -    )  # type: ignore[assignment]
    -    "float : Width of the beam of light as min(width, height) // n of the input text."
    -
    -    beam_falloff: float = ArgField(
    -        cmd_name="--beam-falloff",
    -        type_parser=arg_validators.NonNegativeFloat.type_parser,
    -        default=0.3,
    -        metavar=arg_validators.NonNegativeFloat.METAVAR,
    -        help="Distance from the edge of the beam where the brightness begins to fall off, as a percentage of total beam width.",
    -    )  # type: ignore[assignment]
    -    "float : Distance from the edge of the beam where the brightness begins to fall off, as a percentage of total beam width."
    -
    -    search_duration: int = ArgField(
    -        cmd_name="--search-duration",
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        default=750,
    -        metavar=arg_validators.PositiveInt.METAVAR,
    -        help="Duration of the search phase, in frames, before the spotlights converge in the center.",
    -    )  # type: ignore[assignment]
    -    "int : Duration of the search phase, in frames, before the spotlights converge in the center."
    -
    -    search_speed_range: tuple[float, float] = ArgField(
    -        cmd_name="--search-speed-range",
    -        type_parser=arg_validators.PositiveFloatRange.type_parser,
    -        default=(0.25, 0.5),
    -        metavar=arg_validators.PositiveFloatRange.METAVAR,
    -        help="Range of speeds for the spotlights during the search phase. The speed is a random value between the two provided values.",
    -    )  # type: ignore[assignment]
    -    "tuple[float, float] : Range of speeds for the spotlights during the search phase. The speed is a random value between the two provided values."
    -
    -    spotlight_count: int = ArgField(
    -        cmd_name="--spotlight-count",
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        default=3,
    -        metavar=arg_validators.PositiveInt.METAVAR,
    -        help="Number of spotlights to use.",
    -    )  # type: ignore[assignment]
    -    "int : Number of spotlights to use."
    -
    -    @classmethod
    -    def get_effect_class(cls):
    -        return Spotlights
    +123
    +124
    @argclass(
    +    name="spotlights",
    +    help="Spotlights search the text area, illuminating characters, before converging in the center and expanding.",
    +    description="spotlights | Spotlights search the text area, illuminating characters, before converging in the center and expanding.",
    +    epilog=f"""{argvalidators.EASING_EPILOG}
    +Example: terminaltexteffects spotlights --final-gradient-stops ab48ff e7b2b2 fffebd --final-gradient-steps 12 --beam-width-ratio 2.0 --beam-falloff 0.3 --search-duration 750 --search-speed-range 0.25-0.5 --spotlight-count 3""",
    +)
    +@dataclass
    +class SpotlightsConfig(ArgsDataClass):
    +    """Configuration for the Spotlights effect.
    +
    +    Attributes:
    +        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    +        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    +        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient.
    +        beam_width_ratio (float): Width of the beam of light as min(width, height) // n of the input text. Valid values are n > 0.
    +        beam_falloff (float): Distance from the edge of the beam where the brightness begins to fall off, as a percentage of total beam width. Valid values are 0 <= n <= 1.
    +        search_duration (int): Duration of the search phase, in frames, before the spotlights converge in the center. Valid values are n > 0.
    +        search_speed_range (tuple[float, float]): Range of speeds for the spotlights during the search phase. The speed is a random value between the two provided values. Valid values are n > 0.
    +        spotlight_count (int): Number of spotlights to use. Valid values are n > 0.
    +    """
    +
    +    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--final-gradient-stops"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("ab48ff", "e7b2b2", "fffebd"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        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.",
    +    )  # type: ignore[assignment]
    +    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    +
    +    final_gradient_steps: tuple[int, ...] = ArgField(
    +        cmd_name="--final-gradient-steps",
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        nargs="+",
    +        default=(12,),
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        help="Number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    +    )  # type: ignore[assignment]
    +    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    +
    +    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    +        cmd_name="--final-gradient-direction",
    +        type_parser=argvalidators.GradientDirection.type_parser,
    +        default=graphics.Gradient.Direction.VERTICAL,
    +        metavar=argvalidators.GradientDirection.METAVAR,
    +        help="Direction of the final gradient.",
    +    )  # type: ignore[assignment]
    +    "graphics.Gradient.Direction : Direction of the final gradient."
    +
    +    beam_width_ratio: float = ArgField(
    +        cmd_name="--beam-width-ratio",
    +        type_parser=argvalidators.PositiveFloat.type_parser,
    +        default=2.0,
    +        metavar=argvalidators.PositiveFloat.METAVAR,
    +        help="Width of the beam of light as min(width, height) // n of the input text.",
    +    )  # type: ignore[assignment]
    +    "float : Width of the beam of light as min(width, height) // n of the input text."
    +
    +    beam_falloff: float = ArgField(
    +        cmd_name="--beam-falloff",
    +        type_parser=argvalidators.NonNegativeFloat.type_parser,
    +        default=0.3,
    +        metavar=argvalidators.NonNegativeFloat.METAVAR,
    +        help="Distance from the edge of the beam where the brightness begins to fall off, as a percentage of total beam width.",
    +    )  # type: ignore[assignment]
    +    "float : Distance from the edge of the beam where the brightness begins to fall off, as a percentage of total beam width."
    +
    +    search_duration: int = ArgField(
    +        cmd_name="--search-duration",
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        default=750,
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        help="Duration of the search phase, in frames, before the spotlights converge in the center.",
    +    )  # type: ignore[assignment]
    +    "int : Duration of the search phase, in frames, before the spotlights converge in the center."
    +
    +    search_speed_range: tuple[float, float] = ArgField(
    +        cmd_name="--search-speed-range",
    +        type_parser=argvalidators.PositiveFloatRange.type_parser,
    +        default=(0.25, 0.5),
    +        metavar=argvalidators.PositiveFloatRange.METAVAR,
    +        help="Range of speeds for the spotlights during the search phase. The speed is a random value between the two provided values.",
    +    )  # type: ignore[assignment]
    +    "tuple[float, float] : Range of speeds for the spotlights during the search phase. The speed is a random value between the two provided values."
    +
    +    spotlight_count: int = ArgField(
    +        cmd_name="--spotlight-count",
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        default=3,
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        help="Number of spotlights to use.",
    +    )  # type: ignore[assignment]
    +    "int : Number of spotlights to use."
    +
    +    @classmethod
    +    def get_effect_class(cls):
    +        return Spotlights
     
    @@ -1924,7 +2541,7 @@

    - beam_falloff: float = ArgField(cmd_name='--beam-falloff', type_parser=arg_validators.NonNegativeFloat.type_parser, default=0.3, metavar=arg_validators.NonNegativeFloat.METAVAR, help='Distance from the edge of the beam where the brightness begins to fall off, as a percentage of total beam width.') + beam_falloff: float = ArgField(cmd_name='--beam-falloff', type_parser=argvalidators.NonNegativeFloat.type_parser, default=0.3, metavar=argvalidators.NonNegativeFloat.METAVAR, help='Distance from the edge of the beam where the brightness begins to fall off, as a percentage of total beam width.') class-attribute @@ -1946,7 +2563,7 @@

    - beam_width_ratio: float = ArgField(cmd_name='--beam-width-ratio', type_parser=arg_validators.PositiveFloat.type_parser, default=2.0, metavar=arg_validators.PositiveFloat.METAVAR, help='Width of the beam of light as min(width, height) // n of the input text.') + beam_width_ratio: float = ArgField(cmd_name='--beam-width-ratio', type_parser=argvalidators.PositiveFloat.type_parser, default=2.0, metavar=argvalidators.PositiveFloat.METAVAR, help='Width of the beam of light as min(width, height) // n of the input text.') class-attribute @@ -1968,7 +2585,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1990,7 +2607,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2012,7 +2629,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('ab48ff', 'e7b2b2', 'fffebd'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('ab48ff', 'e7b2b2', 'fffebd'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2034,7 +2651,7 @@

    - search_duration: int = ArgField(cmd_name='--search-duration', type_parser=arg_validators.PositiveInt.type_parser, default=750, metavar=arg_validators.PositiveInt.METAVAR, help='Duration of the search phase, in frames, before the spotlights converge in the center.') + search_duration: int = ArgField(cmd_name='--search-duration', type_parser=argvalidators.PositiveInt.type_parser, default=750, metavar=argvalidators.PositiveInt.METAVAR, help='Duration of the search phase, in frames, before the spotlights converge in the center.') class-attribute @@ -2056,7 +2673,7 @@

    - search_speed_range: tuple[float, float] = ArgField(cmd_name='--search-speed-range', type_parser=arg_validators.PositiveFloatRange.type_parser, default=(0.25, 0.5), metavar=arg_validators.PositiveFloatRange.METAVAR, help='Range of speeds for the spotlights during the search phase. The speed is a random value between the two provided values.') + search_speed_range: tuple[float, float] = ArgField(cmd_name='--search-speed-range', type_parser=argvalidators.PositiveFloatRange.type_parser, default=(0.25, 0.5), metavar=argvalidators.PositiveFloatRange.METAVAR, help='Range of speeds for the spotlights during the search phase. The speed is a random value between the two provided values.') class-attribute @@ -2078,7 +2695,7 @@

    - spotlight_count: int = ArgField(cmd_name='--spotlight-count', type_parser=arg_validators.PositiveInt.type_parser, default=3, metavar=arg_validators.PositiveInt.METAVAR, help='Number of spotlights to use.') + spotlight_count: int = ArgField(cmd_name='--spotlight-count', type_parser=argvalidators.PositiveInt.type_parser, default=3, metavar=argvalidators.PositiveInt.METAVAR, help='Number of spotlights to use.') class-attribute diff --git a/effects/spray/index.html b/effects/spray/index.html index 7c45e236..e1671d49 100755 --- a/effects/spray/index.html +++ b/effects/spray/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1399,7 +2016,7 @@

    - Bases: BaseEffect[SprayConfig]

    + Bases: BaseEffect[SprayConfig]

    Sprays the characters from a single point.

    @@ -1581,7 +2198,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Spray effect.

    @@ -1623,7 +2240,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1769,7 +2386,7 @@

    name="spray", help="Draws the characters spawning at varying rates from a single point.", description="spray | Draws the characters spawning at varying rates from a single point.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects spray --final-gradient-stops 8A008A 00D1FF FFFFFF --final-gradient-steps 12 --spray-position e --spray-volume 0.005 --movement-speed 0.4-1.0 --movement-easing OUT_EXPO""", ) @dataclass @@ -1787,29 +2404,29 @@

    final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("8A008A", "00D1FF", "FFFFFF"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name=["--final-gradient-steps"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." @@ -1824,25 +2441,25 @@

    spray_volume: float = ArgField( cmd_name="--spray-volume", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.005, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Number of characters to spray per tick as a percent of the total number of characters.", ) # type: ignore[assignment] "float : Number of characters to spray per tick as a percent of the total number of characters." movement_speed: tuple[float, float] = ArgField( cmd_name="--movement-speed", - type_parser=arg_validators.PositiveFloatRange.type_parser, + type_parser=argvalidators.PositiveFloatRange.type_parser, default=(0.4, 1.0), - metavar=arg_validators.PositiveFloatRange.METAVAR, + metavar=argvalidators.PositiveFloatRange.METAVAR, help="Movement speed of the characters.", ) # type: ignore[assignment] "tuple[float, float] : Movement speed of the characters." movement_easing: easing.EasingFunction = ArgField( cmd_name="--movement-easing", - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, default=easing.out_expo, help="Easing function to use for character movement.", ) # type: ignore[assignment] @@ -1869,7 +2486,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1891,7 +2508,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1913,7 +2530,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -1935,7 +2552,7 @@

    - movement_easing: easing.EasingFunction = ArgField(cmd_name='--movement-easing', type_parser=arg_validators.Ease.type_parser, default=easing.out_expo, help='Easing function to use for character movement.') + movement_easing: easing.EasingFunction = ArgField(cmd_name='--movement-easing', type_parser=argvalidators.Ease.type_parser, default=easing.out_expo, help='Easing function to use for character movement.') class-attribute @@ -1957,7 +2574,7 @@

    - movement_speed: tuple[float, float] = ArgField(cmd_name='--movement-speed', type_parser=arg_validators.PositiveFloatRange.type_parser, default=(0.4, 1.0), metavar=arg_validators.PositiveFloatRange.METAVAR, help='Movement speed of the characters.') + movement_speed: tuple[float, float] = ArgField(cmd_name='--movement-speed', type_parser=argvalidators.PositiveFloatRange.type_parser, default=(0.4, 1.0), metavar=argvalidators.PositiveFloatRange.METAVAR, help='Movement speed of the characters.') class-attribute @@ -2001,7 +2618,7 @@

    - spray_volume: float = ArgField(cmd_name='--spray-volume', type_parser=arg_validators.PositiveFloat.type_parser, default=0.005, metavar=arg_validators.PositiveFloat.METAVAR, help='Number of characters to spray per tick as a percent of the total number of characters.') + spray_volume: float = ArgField(cmd_name='--spray-volume', type_parser=argvalidators.PositiveFloat.type_parser, default=0.005, metavar=argvalidators.PositiveFloat.METAVAR, help='Number of characters to spray per tick as a percent of the total number of characters.') class-attribute diff --git a/effects/swarm/index.html b/effects/swarm/index.html index 63bf40a0..5485ccba 100755 --- a/effects/swarm/index.html +++ b/effects/swarm/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1417,7 +2034,7 @@

    - Bases: BaseEffect[SwarmConfig]

    + Bases: BaseEffect[SwarmConfig]

    Characters are grouped into swarms and move around the terminal before settling into position.

    @@ -1461,8 +2078,7 @@

    Source code in terminaltexteffects/effects/effect_swarm.py -
    275
    -276
    +              
    276
     277
     278
     279
    @@ -1477,23 +2093,24 @@ 

    288 289 290 -291

    class Swarm(BaseEffect[SwarmConfig]):
    -    """Characters are grouped into swarms and move around the terminal before settling into position.
    -
    -    Attributes:
    -        effect_config (SwarmConfig): Configuration for the effect.
    -        terminal_config (TerminalConfig): Configuration for the terminal.
    -    """
    -
    -    _config_cls = SwarmConfig
    -    _iterator_cls = SwarmIterator
    -
    -    def __init__(self, input_data: str) -> None:
    -        """Initialize the effect with the provided input data.
    -
    -        Args:
    -            input_data (str): The input data to use for the effect."""
    -        super().__init__(input_data)
    +291
    +292
    class Swarm(BaseEffect[SwarmConfig]):
    +    """Characters are grouped into swarms and move around the terminal before settling into position.
    +
    +    Attributes:
    +        effect_config (SwarmConfig): Configuration for the effect.
    +        terminal_config (TerminalConfig): Configuration for the terminal.
    +    """
    +
    +    _config_cls = SwarmConfig
    +    _iterator_cls = SwarmIterator
    +
    +    def __init__(self, input_data: str) -> None:
    +        """Initialize the effect with the provided input data.
    +
    +        Args:
    +            input_data (str): The input data to use for the effect."""
    +        super().__init__(input_data)
     
    @@ -1556,17 +2173,17 @@

    Source code in terminaltexteffects/effects/effect_swarm.py -
    286
    -287
    +            
    def __init__(self, input_data: str) -> None:
    -    """Initialize the effect with the provided input data.
    -
    -    Args:
    -        input_data (str): The input data to use for the effect."""
    -    super().__init__(input_data)
    +291
    +292
    def __init__(self, input_data: str) -> None:
    +    """Initialize the effect with the provided input data.
    +
    +    Args:
    +        input_data (str): The input data to use for the effect."""
    +    super().__init__(input_data)
     
    @@ -1599,7 +2216,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Swarm effect.

    @@ -1663,7 +2280,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1709,8 +2326,7 @@

    Source code in terminaltexteffects/effects/effect_swarm.py -
     25
    - 26
    +              
     26
      27
      28
      29
    @@ -1806,104 +2422,105 @@ 

    119 120 121 -122

    @argclass(
    -    name="swarm",
    -    help="Characters are grouped into swarms and move around the terminal before settling into position.",
    -    description="swarm | Characters are grouped into swarms and move around the terminal before settling into position.",
    -    epilog="""Example: terminaltexteffects swarm --base-color 31a0d4 --flash-color f2ea79 --final-gradient-stops 31b900 f0ff65 --final-gradient-steps 12 --swarm-size 0.1 --swarm-coordination 0.80 --swarm-area-count 2-4""",
    -)
    -@dataclass
    -class SwarmConfig(ArgsDataClass):
    -    """Configuration for the Swarm effect.
    -
    -    Attributes:
    -        base_color (tuple[graphics.Color, ...]): Tuple of colors for the swarms.
    -        flash_color (graphics.Color): Color for the character flash. Characters flash when moving.
    -        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    -        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    -        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient.
    -        swarm_size (float): Percent of total characters in each swarm. Valid values are 0 < n <= 1.
    -        swarm_coordination (float): Percent of characters in a swarm that move as a group. Valid values are 0 < n <= 1.
    -        swarm_area_count (tuple[int, int]): Range of the number of areas where characters will swarm. Valid values are n > 0."""
    -
    -    base_color: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--base-color"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("31a0d4",),
    -        metavar=arg_validators.Color.METAVAR,
    -        help="Space separated, unquoted, list of colors for the swarms",
    -    )  # type: ignore[assignment]
    -    """tuple[graphics.Color, ...] : Tuple of colors for the swarms"""
    -
    -    flash_color: graphics.Color = ArgField(
    -        cmd_name=["--flash-color"],
    -        type_parser=arg_validators.Color.type_parser,
    -        default="f2ea79",
    -        metavar=arg_validators.Color.METAVAR,
    -        help="Color for the character flash. Characters flash when moving.",
    -    )  # type: ignore[assignment]
    -    """graphics.Color : Color for the character flash. Characters flash when moving."""
    -
    -    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--final-gradient-stops"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("31b900", "f0ff65"),
    -        metavar=arg_validators.Color.METAVAR,
    -        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.",
    -    )  # type: ignore[assignment]
    -    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    -
    -    final_gradient_steps: tuple[int, ...] = ArgField(
    -        cmd_name=["--final-gradient-steps"],
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        nargs="+",
    -        default=(12,),
    -        metavar=arg_validators.PositiveInt.METAVAR,
    -        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    -    )  # type: ignore[assignment]
    -    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    -
    -    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    -        cmd_name="--final-gradient-direction",
    -        type_parser=arg_validators.GradientDirection.type_parser,
    -        default=graphics.Gradient.Direction.HORIZONTAL,
    -        metavar=arg_validators.GradientDirection.METAVAR,
    -        help="Direction of the final gradient.",
    -    )  # type: ignore[assignment]
    -    "graphics.Gradient.Direction : Direction of the final gradient."
    -
    -    swarm_size: float = ArgField(
    -        cmd_name="--swarm-size",
    -        type_parser=arg_validators.Ratio.type_parser,
    -        metavar=arg_validators.Ratio.METAVAR,
    -        default=0.1,
    -        help="Percent of total characters in each swarm.",
    -    )  # type: ignore[assignment]
    -    "float : Percent of total characters in each swarm."
    -
    -    swarm_coordination: float = ArgField(
    -        cmd_name="--swarm-coordination",
    -        type_parser=arg_validators.Ratio.type_parser,
    -        metavar=arg_validators.Ratio.METAVAR,
    -        default=0.80,
    -        help="Percent of characters in a swarm that move as a group.",
    -    )  # type: ignore[assignment]
    -    "float : Percent of characters in a swarm that move as a group."
    -
    -    swarm_area_count: tuple[int, int] = ArgField(
    -        cmd_name="--swarm-area-count",
    -        type_parser=arg_validators.IntRange.type_parser,
    -        metavar=arg_validators.IntRange.METAVAR,
    -        default=(2, 4),
    -        help="Range of the number of areas where characters will swarm.",
    -    )  # type: ignore[assignment]
    -    "tuple[int, int] : Range of the number of areas where characters will swarm."
    -
    -    @classmethod
    -    def get_effect_class(cls):
    -        return Swarm
    +122
    +123
    @argclass(
    +    name="swarm",
    +    help="Characters are grouped into swarms and move around the terminal before settling into position.",
    +    description="swarm | Characters are grouped into swarms and move around the terminal before settling into position.",
    +    epilog="""Example: terminaltexteffects swarm --base-color 31a0d4 --flash-color f2ea79 --final-gradient-stops 31b900 f0ff65 --final-gradient-steps 12 --swarm-size 0.1 --swarm-coordination 0.80 --swarm-area-count 2-4""",
    +)
    +@dataclass
    +class SwarmConfig(ArgsDataClass):
    +    """Configuration for the Swarm effect.
    +
    +    Attributes:
    +        base_color (tuple[graphics.Color, ...]): Tuple of colors for the swarms.
    +        flash_color (graphics.Color): Color for the character flash. Characters flash when moving.
    +        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    +        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    +        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient.
    +        swarm_size (float): Percent of total characters in each swarm. Valid values are 0 < n <= 1.
    +        swarm_coordination (float): Percent of characters in a swarm that move as a group. Valid values are 0 < n <= 1.
    +        swarm_area_count (tuple[int, int]): Range of the number of areas where characters will swarm. Valid values are n > 0."""
    +
    +    base_color: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--base-color"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("31a0d4",),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        help="Space separated, unquoted, list of colors for the swarms",
    +    )  # type: ignore[assignment]
    +    """tuple[graphics.Color, ...] : Tuple of colors for the swarms"""
    +
    +    flash_color: graphics.Color = ArgField(
    +        cmd_name=["--flash-color"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        default="f2ea79",
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        help="Color for the character flash. Characters flash when moving.",
    +    )  # type: ignore[assignment]
    +    """graphics.Color : Color for the character flash. Characters flash when moving."""
    +
    +    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--final-gradient-stops"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("31b900", "f0ff65"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        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.",
    +    )  # type: ignore[assignment]
    +    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    +
    +    final_gradient_steps: tuple[int, ...] = ArgField(
    +        cmd_name=["--final-gradient-steps"],
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        nargs="+",
    +        default=(12,),
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    +    )  # type: ignore[assignment]
    +    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    +
    +    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    +        cmd_name="--final-gradient-direction",
    +        type_parser=argvalidators.GradientDirection.type_parser,
    +        default=graphics.Gradient.Direction.HORIZONTAL,
    +        metavar=argvalidators.GradientDirection.METAVAR,
    +        help="Direction of the final gradient.",
    +    )  # type: ignore[assignment]
    +    "graphics.Gradient.Direction : Direction of the final gradient."
    +
    +    swarm_size: float = ArgField(
    +        cmd_name="--swarm-size",
    +        type_parser=argvalidators.Ratio.type_parser,
    +        metavar=argvalidators.Ratio.METAVAR,
    +        default=0.1,
    +        help="Percent of total characters in each swarm.",
    +    )  # type: ignore[assignment]
    +    "float : Percent of total characters in each swarm."
    +
    +    swarm_coordination: float = ArgField(
    +        cmd_name="--swarm-coordination",
    +        type_parser=argvalidators.Ratio.type_parser,
    +        metavar=argvalidators.Ratio.METAVAR,
    +        default=0.80,
    +        help="Percent of characters in a swarm that move as a group.",
    +    )  # type: ignore[assignment]
    +    "float : Percent of characters in a swarm that move as a group."
    +
    +    swarm_area_count: tuple[int, int] = ArgField(
    +        cmd_name="--swarm-area-count",
    +        type_parser=argvalidators.IntRange.type_parser,
    +        metavar=argvalidators.IntRange.METAVAR,
    +        default=(2, 4),
    +        help="Range of the number of areas where characters will swarm.",
    +    )  # type: ignore[assignment]
    +    "tuple[int, int] : Range of the number of areas where characters will swarm."
    +
    +    @classmethod
    +    def get_effect_class(cls):
    +        return Swarm
     
    @@ -1922,7 +2539,7 @@

    - base_color: tuple[graphics.Color, ...] = ArgField(cmd_name=['--base-color'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('31a0d4'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the swarms') + base_color: tuple[graphics.Color, ...] = ArgField(cmd_name=['--base-color'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('31a0d4'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the swarms') class-attribute @@ -1944,7 +2561,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.HORIZONTAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.HORIZONTAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1966,7 +2583,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1988,7 +2605,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('31b900', 'f0ff65'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('31b900', 'f0ff65'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2010,7 +2627,7 @@

    - flash_color: graphics.Color = ArgField(cmd_name=['--flash-color'], type_parser=arg_validators.Color.type_parser, default='f2ea79', metavar=arg_validators.Color.METAVAR, help='Color for the character flash. Characters flash when moving.') + flash_color: graphics.Color = ArgField(cmd_name=['--flash-color'], type_parser=argvalidators.ColorArg.type_parser, default='f2ea79', metavar=argvalidators.ColorArg.METAVAR, help='Color for the character flash. Characters flash when moving.') class-attribute @@ -2032,7 +2649,7 @@

    - swarm_area_count: tuple[int, int] = ArgField(cmd_name='--swarm-area-count', type_parser=arg_validators.IntRange.type_parser, metavar=arg_validators.IntRange.METAVAR, default=(2, 4), help='Range of the number of areas where characters will swarm.') + swarm_area_count: tuple[int, int] = ArgField(cmd_name='--swarm-area-count', type_parser=argvalidators.IntRange.type_parser, metavar=argvalidators.IntRange.METAVAR, default=(2, 4), help='Range of the number of areas where characters will swarm.') class-attribute @@ -2054,7 +2671,7 @@

    - swarm_coordination: float = ArgField(cmd_name='--swarm-coordination', type_parser=arg_validators.Ratio.type_parser, metavar=arg_validators.Ratio.METAVAR, default=0.8, help='Percent of characters in a swarm that move as a group.') + swarm_coordination: float = ArgField(cmd_name='--swarm-coordination', type_parser=argvalidators.Ratio.type_parser, metavar=argvalidators.Ratio.METAVAR, default=0.8, help='Percent of characters in a swarm that move as a group.') class-attribute @@ -2076,7 +2693,7 @@

    - swarm_size: float = ArgField(cmd_name='--swarm-size', type_parser=arg_validators.Ratio.type_parser, metavar=arg_validators.Ratio.METAVAR, default=0.1, help='Percent of total characters in each swarm.') + swarm_size: float = ArgField(cmd_name='--swarm-size', type_parser=argvalidators.Ratio.type_parser, metavar=argvalidators.Ratio.METAVAR, default=0.1, help='Percent of total characters in each swarm.') class-attribute diff --git a/effects/synthgrid/index.html b/effects/synthgrid/index.html index 979927d9..8ad4a611 100755 --- a/effects/synthgrid/index.html +++ b/effects/synthgrid/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1471,7 +2088,7 @@

    - Bases: BaseEffect[SynthGridConfig]

    + Bases: BaseEffect[SynthGridConfig]

    Create a grid which fills with characters dissolving into the final text.

    @@ -1653,7 +2270,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the SynthGrid effect.

    @@ -1695,7 +2312,7 @@

    grid_gradient_direction - Direction + Direction
    @@ -1728,7 +2345,7 @@

    text_gradient_direction - Direction + Direction
    @@ -1928,95 +2545,95 @@

    grid_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--grid-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("CC00CC", "ffffff"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Space separated, unquoted, list of colors for the grid gradient.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the grid gradient." grid_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--grid-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." grid_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--grid-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the gradient for the grid color.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the gradient for the grid color." text_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--text-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("8A008A", "00D1FF", "FFFFFF"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Space separated, unquoted, list of colors for the text gradient.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the text gradient." text_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--text-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." text_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--text-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the gradient for the text color.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the gradient for the text color." grid_row_symbol: str = ArgField( cmd_name="--grid-row-symbol", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, default="─", - metavar=arg_validators.Symbol.METAVAR, + metavar=argvalidators.Symbol.METAVAR, help="Symbol to use for grid row lines.", ) # type: ignore[assignment] "str : Symbol to use for grid row lines." grid_column_symbol: str = ArgField( cmd_name="--grid-column-symbol", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, default="│", - metavar=arg_validators.Symbol.METAVAR, + metavar=argvalidators.Symbol.METAVAR, help="Symbol to use for grid column lines.", ) # type: ignore[assignment] "str : Symbol to use for grid column lines." text_generation_symbols: tuple[str, ...] = ArgField( cmd_name="--text-generation-symbols", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, nargs="+", default=("░", "▒", "▓"), - metavar=arg_validators.Symbol.METAVAR, + metavar=argvalidators.Symbol.METAVAR, help="Space separated, unquoted, list of characters for the text generation animation.", ) # type: ignore[assignment] "tuple[str, ...] : Tuple of characters for the text generation animation." max_active_blocks: float = ArgField( cmd_name="--max-active-blocks", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.1, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Maximum percentage of blocks to have active at any given time. For example, if set to 0.1, 10 percent of the blocks will be active at any given time.", ) # type: ignore[assignment] "float : Maximum percentage of blocks to have active at any given time." @@ -2042,7 +2659,7 @@

    - grid_column_symbol: str = ArgField(cmd_name='--grid-column-symbol', type_parser=arg_validators.Symbol.type_parser, default='│', metavar=arg_validators.Symbol.METAVAR, help='Symbol to use for grid column lines.') + grid_column_symbol: str = ArgField(cmd_name='--grid-column-symbol', type_parser=argvalidators.Symbol.type_parser, default='│', metavar=argvalidators.Symbol.METAVAR, help='Symbol to use for grid column lines.') class-attribute @@ -2064,7 +2681,7 @@

    - grid_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--grid-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the gradient for the grid color.') + grid_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--grid-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the gradient for the grid color.') class-attribute @@ -2086,7 +2703,7 @@

    - grid_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--grid-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + grid_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--grid-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2108,7 +2725,7 @@

    - grid_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--grid-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('CC00CC', 'ffffff'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the grid gradient.') + grid_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--grid-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('CC00CC', 'ffffff'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the grid gradient.') class-attribute @@ -2130,7 +2747,7 @@

    - grid_row_symbol: str = ArgField(cmd_name='--grid-row-symbol', type_parser=arg_validators.Symbol.type_parser, default='─', metavar=arg_validators.Symbol.METAVAR, help='Symbol to use for grid row lines.') + grid_row_symbol: str = ArgField(cmd_name='--grid-row-symbol', type_parser=argvalidators.Symbol.type_parser, default='─', metavar=argvalidators.Symbol.METAVAR, help='Symbol to use for grid row lines.') class-attribute @@ -2152,7 +2769,7 @@

    - max_active_blocks: float = ArgField(cmd_name='--max-active-blocks', type_parser=arg_validators.PositiveFloat.type_parser, default=0.1, metavar=arg_validators.PositiveFloat.METAVAR, help='Maximum percentage of blocks to have active at any given time. For example, if set to 0.1, 10 percent of the blocks will be active at any given time.') + max_active_blocks: float = ArgField(cmd_name='--max-active-blocks', type_parser=argvalidators.PositiveFloat.type_parser, default=0.1, metavar=argvalidators.PositiveFloat.METAVAR, help='Maximum percentage of blocks to have active at any given time. For example, if set to 0.1, 10 percent of the blocks will be active at any given time.') class-attribute @@ -2174,7 +2791,7 @@

    - text_generation_symbols: tuple[str, ...] = ArgField(cmd_name='--text-generation-symbols', type_parser=arg_validators.Symbol.type_parser, nargs='+', default=('░', '▒', '▓'), metavar=arg_validators.Symbol.METAVAR, help='Space separated, unquoted, list of characters for the text generation animation.') + text_generation_symbols: tuple[str, ...] = ArgField(cmd_name='--text-generation-symbols', type_parser=argvalidators.Symbol.type_parser, nargs='+', default=('░', '▒', '▓'), metavar=argvalidators.Symbol.METAVAR, help='Space separated, unquoted, list of characters for the text generation animation.') class-attribute @@ -2196,7 +2813,7 @@

    - text_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--text-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the gradient for the text color.') + text_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--text-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the gradient for the text color.') class-attribute @@ -2218,7 +2835,7 @@

    - text_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--text-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + text_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--text-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2240,7 +2857,7 @@

    - text_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--text-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the text gradient.') + text_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--text-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the text gradient.') class-attribute @@ -2281,7 +2898,7 @@

    - Bases: BaseEffectIterator[SynthGridConfig]

    + Bases: BaseEffectIterator[SynthGridConfig]

    diff --git a/effects/unstable/index.html b/effects/unstable/index.html index af924d6a..e5bf7a6a 100755 --- a/effects/unstable/index.html +++ b/effects/unstable/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1417,7 +2034,7 @@

    - Bases: BaseEffect[UnstableConfig]

    + Bases: BaseEffect[UnstableConfig]

    Spawns characters jumbled, explodes them to the edge of the output area, then reassembles them.

    @@ -1599,7 +2216,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Unstable effect.

    @@ -1652,7 +2269,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1810,7 +2427,7 @@

    name="unstable", help="Spawn characters jumbled, explode them to the edge of the output area, then reassemble them in the correct layout.", description="unstable | Spawn characters jumbled, explode them to the edge of the output area, then reassemble them in the correct layout.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects unstable --unstable-color ff9200 --final-gradient-stops 8A008A 00D1FF FFFFFF --final-gradient-steps 12 --explosion-ease OUT_EXPO --explosion-speed 0.75 --reassembly-ease OUT_EXPO --reassembly-speed 0.75""", ) @@ -1831,45 +2448,45 @@

    unstable_color: graphics.Color = ArgField( cmd_name=["--unstable-color"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, default="ff9200", - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Color transitioned to as the characters become unstable.", ) # type: ignore[assignment] "graphics.Color : Color transitioned to as the characters become unstable." final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("8A008A", "00D1FF", "FFFFFF"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name=["--final-gradient-steps"], - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." explosion_ease: easing.EasingFunction = ArgField( cmd_name=["--explosion-ease"], - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, default=easing.out_expo, help="Easing function to use for character movement during the explosion.", ) # type: ignore[assignment] @@ -1877,16 +2494,16 @@

    explosion_speed: float = ArgField( cmd_name=["--explosion-speed"], - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.75, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Speed of characters during explosion. ", ) # type: ignore[assignment] "float : Speed of characters during explosion. " reassembly_ease: easing.EasingFunction = ArgField( cmd_name=["--reassembly-ease"], - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, default=easing.out_expo, help="Easing function to use for character reassembly.", ) # type: ignore[assignment] @@ -1894,9 +2511,9 @@

    reassembly_speed: float = ArgField( cmd_name=["--reassembly-speed"], - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.75, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Speed of characters during reassembly. ", ) # type: ignore[assignment] "float : Speed of characters during reassembly." @@ -1922,7 +2539,7 @@

    - explosion_ease: easing.EasingFunction = ArgField(cmd_name=['--explosion-ease'], type_parser=arg_validators.Ease.type_parser, default=easing.out_expo, help='Easing function to use for character movement during the explosion.') + explosion_ease: easing.EasingFunction = ArgField(cmd_name=['--explosion-ease'], type_parser=argvalidators.Ease.type_parser, default=easing.out_expo, help='Easing function to use for character movement during the explosion.') class-attribute @@ -1944,7 +2561,7 @@

    - explosion_speed: float = ArgField(cmd_name=['--explosion-speed'], type_parser=arg_validators.PositiveFloat.type_parser, default=0.75, metavar=arg_validators.PositiveFloat.METAVAR, help='Speed of characters during explosion. ') + explosion_speed: float = ArgField(cmd_name=['--explosion-speed'], type_parser=argvalidators.PositiveFloat.type_parser, default=0.75, metavar=argvalidators.PositiveFloat.METAVAR, help='Speed of characters during explosion. ') class-attribute @@ -1966,7 +2583,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1988,7 +2605,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name=['--final-gradient-steps'], type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2010,7 +2627,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2032,7 +2649,7 @@

    - reassembly_ease: easing.EasingFunction = ArgField(cmd_name=['--reassembly-ease'], type_parser=arg_validators.Ease.type_parser, default=easing.out_expo, help='Easing function to use for character reassembly.') + reassembly_ease: easing.EasingFunction = ArgField(cmd_name=['--reassembly-ease'], type_parser=argvalidators.Ease.type_parser, default=easing.out_expo, help='Easing function to use for character reassembly.') class-attribute @@ -2054,7 +2671,7 @@

    - reassembly_speed: float = ArgField(cmd_name=['--reassembly-speed'], type_parser=arg_validators.PositiveFloat.type_parser, default=0.75, metavar=arg_validators.PositiveFloat.METAVAR, help='Speed of characters during reassembly. ') + reassembly_speed: float = ArgField(cmd_name=['--reassembly-speed'], type_parser=argvalidators.PositiveFloat.type_parser, default=0.75, metavar=argvalidators.PositiveFloat.METAVAR, help='Speed of characters during reassembly. ') class-attribute @@ -2076,7 +2693,7 @@

    - unstable_color: graphics.Color = ArgField(cmd_name=['--unstable-color'], type_parser=arg_validators.Color.type_parser, default='ff9200', metavar=arg_validators.Color.METAVAR, help='Color transitioned to as the characters become unstable.') + unstable_color: graphics.Color = ArgField(cmd_name=['--unstable-color'], type_parser=argvalidators.ColorArg.type_parser, default='ff9200', metavar=argvalidators.ColorArg.METAVAR, help='Color transitioned to as the characters become unstable.') class-attribute diff --git a/effects/verticalslice/index.html b/effects/verticalslice/index.html index 2c850637..845af838 100755 --- a/effects/verticalslice/index.html +++ b/effects/verticalslice/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1363,7 +1980,7 @@

    - Bases: BaseEffect[VerticalSliceConfig]

    + Bases: BaseEffect[VerticalSliceConfig]

    Slices the input in half vertically and slides it into place from opposite directions.

    @@ -1545,7 +2162,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the VerticalSlice effect.

    @@ -1587,7 +2204,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1694,7 +2311,7 @@

    name="verticalslice", help="Slices the input in half vertically and slides it into place from opposite directions.", description="verticalslice | Slices the input in half vertically and slides it into place from opposite directions.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects verticalslice --final-gradient-stops 8A008A 00D1FF FFFFFF --final-gradient-steps 12 --movement-speed 0.15 --movement-easing IN_OUT_EXPO""", ) @@ -1712,45 +2329,45 @@

    final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name=["--final-gradient-stops"], - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("8A008A", "00D1FF", "FFFFFF"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." movement_speed: float = ArgField( cmd_name="--movement-speed", - type_parser=arg_validators.PositiveFloat.type_parser, + type_parser=argvalidators.PositiveFloat.type_parser, default=0.15, - metavar=arg_validators.PositiveFloat.METAVAR, + metavar=argvalidators.PositiveFloat.METAVAR, help="Movement speed of the characters. ", ) # type: ignore[assignment] "float : Movement speed of the characters. " movement_easing: easing.EasingFunction = ArgField( cmd_name="--movement-easing", - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, default=easing.in_out_expo, help="Easing function to use for character movement.", ) # type: ignore[assignment] @@ -1777,7 +2394,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1799,7 +2416,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1821,7 +2438,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('8A008A', '00D1FF', 'FFFFFF'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -1843,7 +2460,7 @@

    - movement_easing: easing.EasingFunction = ArgField(cmd_name='--movement-easing', type_parser=arg_validators.Ease.type_parser, default=easing.in_out_expo, help='Easing function to use for character movement.') + movement_easing: easing.EasingFunction = ArgField(cmd_name='--movement-easing', type_parser=argvalidators.Ease.type_parser, default=easing.in_out_expo, help='Easing function to use for character movement.') class-attribute @@ -1865,7 +2482,7 @@

    - movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=arg_validators.PositiveFloat.type_parser, default=0.15, metavar=arg_validators.PositiveFloat.METAVAR, help='Movement speed of the characters. ') + movement_speed: float = ArgField(cmd_name='--movement-speed', type_parser=argvalidators.PositiveFloat.type_parser, default=0.15, metavar=argvalidators.PositiveFloat.METAVAR, help='Movement speed of the characters. ') class-attribute diff --git a/effects/vhstape/index.html b/effects/vhstape/index.html index 3a288dcb..3e78b9ce 100755 --- a/effects/vhstape/index.html +++ b/effects/vhstape/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1435,7 +2052,7 @@

    - Bases: BaseEffect[VHSTapeConfig]

    + Bases: BaseEffect[VHSTapeConfig]

    Lines of characters glitch left and right and lose detail like an old VHS tape.

    @@ -1479,8 +2096,7 @@

    Source code in terminaltexteffects/effects/effect_vhstape.py -
    414
    -415
    +              
    415
     416
     417
     418
    @@ -1495,23 +2111,24 @@ 

    427 428 429 -430

    class VHSTape(BaseEffect[VHSTapeConfig]):
    -    """Lines of characters glitch left and right and lose detail like an old VHS tape.
    -
    -    Attributes:
    -        effect_config (VHSTapeConfig): Configuration for the effect.
    -        terminal_config (TerminalConfig): Configuration for the terminal.
    -    """
    -
    -    _config_cls = VHSTapeConfig
    -    _iterator_cls = VHSTapeIterator
    -
    -    def __init__(self, input_data: str) -> None:
    -        """Initialize the effect with the provided input data.
    -
    -        Args:
    -            input_data (str): The input data to use for the effect."""
    -        super().__init__(input_data)
    +430
    +431
    class VHSTape(BaseEffect[VHSTapeConfig]):
    +    """Lines of characters glitch left and right and lose detail like an old VHS tape.
    +
    +    Attributes:
    +        effect_config (VHSTapeConfig): Configuration for the effect.
    +        terminal_config (TerminalConfig): Configuration for the terminal.
    +    """
    +
    +    _config_cls = VHSTapeConfig
    +    _iterator_cls = VHSTapeIterator
    +
    +    def __init__(self, input_data: str) -> None:
    +        """Initialize the effect with the provided input data.
    +
    +        Args:
    +            input_data (str): The input data to use for the effect."""
    +        super().__init__(input_data)
     
    @@ -1574,17 +2191,17 @@

    Source code in terminaltexteffects/effects/effect_vhstape.py -
    - + @@ -1319,9 +1927,9 @@

    - + - +
    425
    -426
    +            
    def __init__(self, input_data: str) -> None:
    -    """Initialize the effect with the provided input data.
    -
    -    Args:
    -        input_data (str): The input data to use for the effect."""
    -    super().__init__(input_data)
    +430
    +431
    def __init__(self, input_data: str) -> None:
    +    """Initialize the effect with the provided input data.
    +
    +    Args:
    +        input_data (str): The input data to use for the effect."""
    +    super().__init__(input_data)
     
    @@ -1617,7 +2234,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the VHSTape effect.

    @@ -1659,7 +2276,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1738,8 +2355,7 @@

    Source code in terminaltexteffects/effects/effect_vhstape.py -
    - + - +
     25
    - 26
    +              
     26
      27
      28
      29
    @@ -1847,116 +2463,117 @@ 

    131 132 133 -134

    @argclass(
    -    name="vhstape",
    -    help="Lines of characters glitch left and right and lose detail like an old VHS tape.",
    -    description="vhstape | Lines of characters glitch left and right and lose detail like an old VHS tape.",
    -    epilog="""Example: terminaltexteffects vhstape --final-gradient-stops ab48ff e7b2b2 fffebd --final-gradient-steps 12 --glitch-line-colors ffffff ff0000 00ff00 0000ff ffffff --glitch-wave-colors ffffff ff0000 00ff00 0000ff ffffff --noise-colors 1e1e1f 3c3b3d 6d6c70 a2a1a6 cbc9cf ffffff --glitch-line-chance 0.05 --noise-chance 0.004 --total-glitch-time 1000""",
    -)
    -@dataclass
    -class VHSTapeConfig(ArgsDataClass):
    -    """Configuration for the VHSTape effect.
    -
    -    Attributes:
    -        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    -        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    -        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient.
    -        glitch_line_colors (tuple[graphics.Color, ...]): Tuple of colors for the characters when a single line is glitching. Colors are applied in order as an animation.
    -        glitch_wave_colors (tuple[graphics.Color, ...]): Tuple of colors for the characters in lines that are part of the glitch wave. Colors are applied in order as an animation.
    -        noise_colors (tuple[graphics.Color, ...]): Tuple of colors for the characters during the noise phase.
    -        glitch_line_chance (float): Chance that a line will glitch on any given frame.
    -        noise_chance (float): Chance that all characters will experience noise on any given frame. Valid values are 0 <= n <= 1.
    -        total_glitch_time (int): Total time, in frames, that the glitching phase will last. Valid values are n > 0."""
    -
    -    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name=["--final-gradient-stops"],
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("ab48ff", "e7b2b2", "fffebd"),
    -        metavar=arg_validators.Color.METAVAR,
    -        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.",
    -    )  # type: ignore[assignment]
    -    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    -
    -    final_gradient_steps: tuple[int, ...] = ArgField(
    -        cmd_name="--final-gradient-steps",
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        nargs="+",
    -        default=(12,),
    -        metavar=arg_validators.PositiveInt.METAVAR,
    -        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    -    )  # type: ignore[assignment]
    -    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    -
    -    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    -        cmd_name="--final-gradient-direction",
    -        type_parser=arg_validators.GradientDirection.type_parser,
    -        default=graphics.Gradient.Direction.VERTICAL,
    -        metavar=arg_validators.GradientDirection.METAVAR,
    -        help="Direction of the final gradient.",
    -    )  # type: ignore[assignment]
    -    "graphics.Gradient.Direction : Direction of the final gradient."
    -
    -    glitch_line_colors: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name="--glitch-line-colors",
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("ffffff", "ff0000", "00ff00", "0000ff", "ffffff"),
    -        metavar=arg_validators.Color.METAVAR,
    -        help="Space separated, unquoted, list of colors for the characters when a single line is glitching. Colors are applied in order as an animation.",
    -    )  # type: ignore[assignment]
    -    "tuple[graphics.Color, ...] : Tuple of colors for the characters when a single line is glitching. Colors are applied in order as an animation."
    -
    -    glitch_wave_colors: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name="--glitch-wave-colors",
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("ffffff", "ff0000", "00ff00", "0000ff", "ffffff"),
    -        metavar=arg_validators.Color.METAVAR,
    -        help="Space separated, unquoted, list of colors for the characters in lines that are part of the glitch wave. Colors are applied in order as an animation.",
    -    )  # type: ignore[assignment]
    -    "tuple[graphics.Color, ...] : Tuple of colors for the characters in lines that are part of the glitch wave. Colors are applied in order as an animation."
    -
    -    noise_colors: tuple[graphics.Color, ...] = ArgField(
    -        cmd_name="--noise-colors",
    -        type_parser=arg_validators.Color.type_parser,
    -        nargs="+",
    -        default=("1e1e1f", "3c3b3d", "6d6c70", "a2a1a6", "cbc9cf", "ffffff"),
    -        metavar=arg_validators.Color.METAVAR,
    -        help="Space separated, unquoted, list of colors for the characters during the noise phase.",
    -    )  # type: ignore[assignment]
    -    "tuple[graphics.Color, ...] : Tuple of colors for the characters during the noise phase."
    -
    -    glitch_line_chance: float = ArgField(
    -        cmd_name="--glitch-line-chance",
    -        type_parser=arg_validators.Ratio.type_parser,
    -        default=0.05,
    -        metavar=arg_validators.Ratio.METAVAR,
    -        help="Chance that a line will glitch on any given frame.",
    -    )  # type: ignore[assignment]
    -    "float : Chance that a line will glitch on any given frame."
    -
    -    noise_chance: float = ArgField(
    -        cmd_name="--noise-chance",
    -        type_parser=arg_validators.Ratio.type_parser,
    -        default=0.004,
    -        metavar=arg_validators.Ratio.METAVAR,
    -        help="Chance that all characters will experience noise on any given frame.",
    -    )  # type: ignore[assignment]
    -    "float : Chance that all characters will experience noise on any given frame."
    -
    -    total_glitch_time: int = ArgField(
    -        cmd_name="--total-glitch-time",
    -        type_parser=arg_validators.PositiveInt.type_parser,
    -        default=1000,
    -        metavar=arg_validators.PositiveInt.METAVAR,
    -        help="Total time, frames, that the glitching phase will last.",
    -    )  # type: ignore[assignment]
    -    "int : Total time, frames, that the glitching phase will last."
    -
    -    @classmethod
    -    def get_effect_class(cls):
    -        return VHSTape
    +134
    +135
    @argclass(
    +    name="vhstape",
    +    help="Lines of characters glitch left and right and lose detail like an old VHS tape.",
    +    description="vhstape | Lines of characters glitch left and right and lose detail like an old VHS tape.",
    +    epilog="""Example: terminaltexteffects vhstape --final-gradient-stops ab48ff e7b2b2 fffebd --final-gradient-steps 12 --glitch-line-colors ffffff ff0000 00ff00 0000ff ffffff --glitch-wave-colors ffffff ff0000 00ff00 0000ff ffffff --noise-colors 1e1e1f 3c3b3d 6d6c70 a2a1a6 cbc9cf ffffff --glitch-line-chance 0.05 --noise-chance 0.004 --total-glitch-time 1000""",
    +)
    +@dataclass
    +class VHSTapeConfig(ArgsDataClass):
    +    """Configuration for the VHSTape effect.
    +
    +    Attributes:
    +        final_gradient_stops (tuple[graphics.Color, ...]): Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color.
    +        final_gradient_steps (tuple[int, ...]): Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation. Valid values are n > 0.
    +        final_gradient_direction (graphics.Gradient.Direction): Direction of the final gradient.
    +        glitch_line_colors (tuple[graphics.Color, ...]): Tuple of colors for the characters when a single line is glitching. Colors are applied in order as an animation.
    +        glitch_wave_colors (tuple[graphics.Color, ...]): Tuple of colors for the characters in lines that are part of the glitch wave. Colors are applied in order as an animation.
    +        noise_colors (tuple[graphics.Color, ...]): Tuple of colors for the characters during the noise phase.
    +        glitch_line_chance (float): Chance that a line will glitch on any given frame.
    +        noise_chance (float): Chance that all characters will experience noise on any given frame. Valid values are 0 <= n <= 1.
    +        total_glitch_time (int): Total time, in frames, that the glitching phase will last. Valid values are n > 0."""
    +
    +    final_gradient_stops: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name=["--final-gradient-stops"],
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("ab48ff", "e7b2b2", "fffebd"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        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.",
    +    )  # type: ignore[assignment]
    +    "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color."
    +
    +    final_gradient_steps: tuple[int, ...] = ArgField(
    +        cmd_name="--final-gradient-steps",
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        nargs="+",
    +        default=(12,),
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.",
    +    )  # type: ignore[assignment]
    +    "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation."
    +
    +    final_gradient_direction: graphics.Gradient.Direction = ArgField(
    +        cmd_name="--final-gradient-direction",
    +        type_parser=argvalidators.GradientDirection.type_parser,
    +        default=graphics.Gradient.Direction.VERTICAL,
    +        metavar=argvalidators.GradientDirection.METAVAR,
    +        help="Direction of the final gradient.",
    +    )  # type: ignore[assignment]
    +    "graphics.Gradient.Direction : Direction of the final gradient."
    +
    +    glitch_line_colors: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name="--glitch-line-colors",
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("ffffff", "ff0000", "00ff00", "0000ff", "ffffff"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        help="Space separated, unquoted, list of colors for the characters when a single line is glitching. Colors are applied in order as an animation.",
    +    )  # type: ignore[assignment]
    +    "tuple[graphics.Color, ...] : Tuple of colors for the characters when a single line is glitching. Colors are applied in order as an animation."
    +
    +    glitch_wave_colors: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name="--glitch-wave-colors",
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("ffffff", "ff0000", "00ff00", "0000ff", "ffffff"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        help="Space separated, unquoted, list of colors for the characters in lines that are part of the glitch wave. Colors are applied in order as an animation.",
    +    )  # type: ignore[assignment]
    +    "tuple[graphics.Color, ...] : Tuple of colors for the characters in lines that are part of the glitch wave. Colors are applied in order as an animation."
    +
    +    noise_colors: tuple[graphics.Color, ...] = ArgField(
    +        cmd_name="--noise-colors",
    +        type_parser=argvalidators.ColorArg.type_parser,
    +        nargs="+",
    +        default=("1e1e1f", "3c3b3d", "6d6c70", "a2a1a6", "cbc9cf", "ffffff"),
    +        metavar=argvalidators.ColorArg.METAVAR,
    +        help="Space separated, unquoted, list of colors for the characters during the noise phase.",
    +    )  # type: ignore[assignment]
    +    "tuple[graphics.Color, ...] : Tuple of colors for the characters during the noise phase."
    +
    +    glitch_line_chance: float = ArgField(
    +        cmd_name="--glitch-line-chance",
    +        type_parser=argvalidators.Ratio.type_parser,
    +        default=0.05,
    +        metavar=argvalidators.Ratio.METAVAR,
    +        help="Chance that a line will glitch on any given frame.",
    +    )  # type: ignore[assignment]
    +    "float : Chance that a line will glitch on any given frame."
    +
    +    noise_chance: float = ArgField(
    +        cmd_name="--noise-chance",
    +        type_parser=argvalidators.Ratio.type_parser,
    +        default=0.004,
    +        metavar=argvalidators.Ratio.METAVAR,
    +        help="Chance that all characters will experience noise on any given frame.",
    +    )  # type: ignore[assignment]
    +    "float : Chance that all characters will experience noise on any given frame."
    +
    +    total_glitch_time: int = ArgField(
    +        cmd_name="--total-glitch-time",
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        default=1000,
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        help="Total time, frames, that the glitching phase will last.",
    +    )  # type: ignore[assignment]
    +    "int : Total time, frames, that the glitching phase will last."
    +
    +    @classmethod
    +    def get_effect_class(cls):
    +        return VHSTape
     
    @@ -1975,7 +2592,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1997,7 +2614,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2019,7 +2636,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=arg_validators.Color.type_parser, nargs='+', default=('ab48ff', 'e7b2b2', 'fffebd'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name=['--final-gradient-stops'], type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('ab48ff', 'e7b2b2', 'fffebd'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2041,7 +2658,7 @@

    - glitch_line_chance: float = ArgField(cmd_name='--glitch-line-chance', type_parser=arg_validators.Ratio.type_parser, default=0.05, metavar=arg_validators.Ratio.METAVAR, help='Chance that a line will glitch on any given frame.') + glitch_line_chance: float = ArgField(cmd_name='--glitch-line-chance', type_parser=argvalidators.Ratio.type_parser, default=0.05, metavar=argvalidators.Ratio.METAVAR, help='Chance that a line will glitch on any given frame.') class-attribute @@ -2063,7 +2680,7 @@

    - glitch_line_colors: tuple[graphics.Color, ...] = ArgField(cmd_name='--glitch-line-colors', type_parser=arg_validators.Color.type_parser, nargs='+', default=('ffffff', 'ff0000', '00ff00', '0000ff', 'ffffff'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the characters when a single line is glitching. Colors are applied in order as an animation.') + glitch_line_colors: tuple[graphics.Color, ...] = ArgField(cmd_name='--glitch-line-colors', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('ffffff', 'ff0000', '00ff00', '0000ff', 'ffffff'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the characters when a single line is glitching. Colors are applied in order as an animation.') class-attribute @@ -2085,7 +2702,7 @@

    - glitch_wave_colors: tuple[graphics.Color, ...] = ArgField(cmd_name='--glitch-wave-colors', type_parser=arg_validators.Color.type_parser, nargs='+', default=('ffffff', 'ff0000', '00ff00', '0000ff', 'ffffff'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the characters in lines that are part of the glitch wave. Colors are applied in order as an animation.') + glitch_wave_colors: tuple[graphics.Color, ...] = ArgField(cmd_name='--glitch-wave-colors', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('ffffff', 'ff0000', '00ff00', '0000ff', 'ffffff'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the characters in lines that are part of the glitch wave. Colors are applied in order as an animation.') class-attribute @@ -2107,7 +2724,7 @@

    - noise_chance: float = ArgField(cmd_name='--noise-chance', type_parser=arg_validators.Ratio.type_parser, default=0.004, metavar=arg_validators.Ratio.METAVAR, help='Chance that all characters will experience noise on any given frame.') + noise_chance: float = ArgField(cmd_name='--noise-chance', type_parser=argvalidators.Ratio.type_parser, default=0.004, metavar=argvalidators.Ratio.METAVAR, help='Chance that all characters will experience noise on any given frame.') class-attribute @@ -2129,7 +2746,7 @@

    - noise_colors: tuple[graphics.Color, ...] = ArgField(cmd_name='--noise-colors', type_parser=arg_validators.Color.type_parser, nargs='+', default=('1e1e1f', '3c3b3d', '6d6c70', 'a2a1a6', 'cbc9cf', 'ffffff'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the characters during the noise phase.') + noise_colors: tuple[graphics.Color, ...] = ArgField(cmd_name='--noise-colors', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('1e1e1f', '3c3b3d', '6d6c70', 'a2a1a6', 'cbc9cf', 'ffffff'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the characters during the noise phase.') class-attribute @@ -2151,7 +2768,7 @@

    - total_glitch_time: int = ArgField(cmd_name='--total-glitch-time', type_parser=arg_validators.PositiveInt.type_parser, default=1000, metavar=arg_validators.PositiveInt.METAVAR, help='Total time, frames, that the glitching phase will last.') + total_glitch_time: int = ArgField(cmd_name='--total-glitch-time', type_parser=argvalidators.PositiveInt.type_parser, default=1000, metavar=argvalidators.PositiveInt.METAVAR, help='Total time, frames, that the glitching phase will last.') class-attribute diff --git a/effects/waves/index.html b/effects/waves/index.html index 8c83b2db..d11eff32 100755 --- a/effects/waves/index.html +++ b/effects/waves/index.html @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1435,7 +2052,7 @@

    - Bases: BaseEffect[WavesConfig]

    + Bases: BaseEffect[WavesConfig]

    Creates waves that travel across the terminal, leaving behind the characters.

    @@ -1617,7 +2234,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Waves effect.

    @@ -1692,7 +2309,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1826,7 +2443,7 @@

    name="waves", help="Waves travel across the terminal leaving behind the characters.", description="waves | Waves travel across the terminal leaving behind the characters.", - epilog=f"""{arg_validators.EASING_EPILOG} + epilog=f"""{argvalidators.EASING_EPILOG} Example: terminaltexteffects waves --wave-symbols ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▇ ▆ ▅ ▄ ▃ ▂ ▁ --wave-gradient-stops f0ff65 ffb102 31a0d4 ffb102 f0ff65 --wave-gradient-steps 6 --final-gradient-stops ffb102 31a0d4 f0ff65 --final-gradient-steps 12 --wave-count 7 --wave-length 2 --wave-easing IN_OUT_SINE""", ) @dataclass @@ -1844,66 +2461,66 @@

    wave_symbols: tuple[str, ...] = ArgField( cmd_name="--wave-symbols", - type_parser=arg_validators.Symbol.type_parser, + type_parser=argvalidators.Symbol.type_parser, default=("▁", "▂", "▃", "▄", "▅", "▆", "▇", "█", "▇", "▆", "▅", "▄", "▃", "▂", "▁"), nargs="+", - metavar=arg_validators.Symbol.METAVAR, + metavar=argvalidators.Symbol.METAVAR, help="Symbols to use for the wave animation. Multi-character strings will be used in sequence to create an animation.", ) # type: ignore[assignment] "tuple[str, ...] : Symbols to use for the wave animation. Multi-character strings will be used in sequence to create an animation." wave_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name="--wave-gradient-stops", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("f0ff65", "ffb102", "31a0d4", "ffb102", "f0ff65"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." wave_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--wave-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(6,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name="--final-gradient-stops", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("ffb102", "31a0d4", "f0ff65"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, 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.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the final color gradient. If only one color is provided, the characters will be displayed in that color." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." wave_count: int = ArgField( cmd_name="--wave-count", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=7, help="Number of waves to generate. n > 0.", ) # type: ignore[assignment] @@ -1911,16 +2528,16 @@

    wave_length: int = ArgField( cmd_name="--wave-length", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=2, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="The number of frames for each step of the wave. Higher wave-lengths will create a slower wave.", ) # type: ignore[assignment] "int : The number of frames for each step of the wave. Higher wave-lengths will create a slower wave." wave_easing: easing.EasingFunction = ArgField( cmd_name="--wave-easing", - type_parser=arg_validators.Ease.type_parser, + type_parser=argvalidators.Ease.type_parser, default=easing.in_out_sine, help="Easing function to use for wave travel.", ) # type: ignore[assignment] @@ -1947,7 +2564,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.DIAGONAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1969,7 +2586,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1991,7 +2608,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=arg_validators.Color.type_parser, nargs='+', default=('ffb102', '31a0d4', 'f0ff65'), metavar=arg_validators.Color.METAVAR, 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.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('ffb102', '31a0d4', 'f0ff65'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2013,7 +2630,7 @@

    - wave_count: int = ArgField(cmd_name='--wave-count', type_parser=arg_validators.PositiveInt.type_parser, default=7, help='Number of waves to generate. n > 0.') + wave_count: int = ArgField(cmd_name='--wave-count', type_parser=argvalidators.PositiveInt.type_parser, default=7, help='Number of waves to generate. n > 0.') class-attribute @@ -2035,7 +2652,7 @@

    - wave_easing: easing.EasingFunction = ArgField(cmd_name='--wave-easing', type_parser=arg_validators.Ease.type_parser, default=easing.in_out_sine, help='Easing function to use for wave travel.') + wave_easing: easing.EasingFunction = ArgField(cmd_name='--wave-easing', type_parser=argvalidators.Ease.type_parser, default=easing.in_out_sine, help='Easing function to use for wave travel.') class-attribute @@ -2057,7 +2674,7 @@

    - wave_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--wave-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(6), metavar=arg_validators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + wave_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--wave-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(6), metavar=argvalidators.PositiveInt.METAVAR, help='Space separated, unquoted, list of the number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -2079,7 +2696,7 @@

    - wave_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--wave-gradient-stops', type_parser=arg_validators.Color.type_parser, nargs='+', default=('f0ff65', 'ffb102', '31a0d4', 'ffb102', 'f0ff65'), metavar=arg_validators.Color.METAVAR, 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.') + wave_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--wave-gradient-stops', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('f0ff65', 'ffb102', '31a0d4', 'ffb102', 'f0ff65'), metavar=argvalidators.ColorArg.METAVAR, 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 @@ -2101,7 +2718,7 @@

    - wave_length: int = ArgField(cmd_name='--wave-length', type_parser=arg_validators.PositiveInt.type_parser, default=2, metavar=arg_validators.PositiveInt.METAVAR, help='The number of frames for each step of the wave. Higher wave-lengths will create a slower wave.') + wave_length: int = ArgField(cmd_name='--wave-length', type_parser=argvalidators.PositiveInt.type_parser, default=2, metavar=argvalidators.PositiveInt.METAVAR, help='The number of frames for each step of the wave. Higher wave-lengths will create a slower wave.') class-attribute @@ -2123,7 +2740,7 @@

    - wave_symbols: tuple[str, ...] = ArgField(cmd_name='--wave-symbols', type_parser=arg_validators.Symbol.type_parser, default=('▁', '▂', '▃', '▄', '▅', '▆', '▇', '█', '▇', '▆', '▅', '▄', '▃', '▂', '▁'), nargs='+', metavar=arg_validators.Symbol.METAVAR, help='Symbols to use for the wave animation. Multi-character strings will be used in sequence to create an animation.') + wave_symbols: tuple[str, ...] = ArgField(cmd_name='--wave-symbols', type_parser=argvalidators.Symbol.type_parser, default=('▁', '▂', '▃', '▄', '▅', '▆', '▇', '█', '▇', '▆', '▅', '▄', '▃', '▂', '▁'), nargs='+', metavar=argvalidators.Symbol.METAVAR, help='Symbols to use for the wave animation. Multi-character strings will be used in sequence to create an animation.') class-attribute diff --git a/effects/wipe/index.html b/effects/wipe/index.html index 8533ff9f..9a1cadbd 100755 --- a/effects/wipe/index.html +++ b/effects/wipe/index.html @@ -12,7 +12,7 @@ - + @@ -221,6 +221,480 @@ + + + + + + + + +
  • + + + + + + + + + +
  • @@ -1381,7 +1998,7 @@

    - Bases: BaseEffect[WipeConfig]

    + Bases: BaseEffect[WipeConfig]

    Performs a wipe across the terminal to reveal characters.

    @@ -1563,7 +2180,7 @@

    - Bases: ArgsDataClass

    + Bases: ArgsDataClass

    Configuration for the Wipe effect.

    @@ -1627,7 +2244,7 @@

    final_gradient_direction - Direction + Direction
    @@ -1772,47 +2389,47 @@

    final_gradient_stops: tuple[graphics.Color, ...] = ArgField( cmd_name="--final-gradient-stops", - type_parser=arg_validators.Color.type_parser, + type_parser=argvalidators.ColorArg.type_parser, nargs="+", default=("833ab4", "fd1d1d", "fcb045"), - metavar=arg_validators.Color.METAVAR, + metavar=argvalidators.ColorArg.METAVAR, help="Space separated, unquoted, list of colors for the wipe gradient.", ) # type: ignore[assignment] "tuple[graphics.Color, ...] : Tuple of colors for the wipe gradient." final_gradient_steps: tuple[int, ...] = ArgField( cmd_name="--final-gradient-steps", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, nargs="+", default=(12,), - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of gradient steps to use. More steps will create a smoother and longer gradient animation.", ) # type: ignore[assignment] "tuple[int, ...] : Tuple of the number of gradient steps to use. More steps will create a smoother and longer gradient animation." final_gradient_frames: int = ArgField( cmd_name="--final-gradient-frames", - type_parser=arg_validators.PositiveInt.type_parser, + type_parser=argvalidators.PositiveInt.type_parser, default=5, - metavar=arg_validators.PositiveInt.METAVAR, + metavar=argvalidators.PositiveInt.METAVAR, help="Number of frames to display each gradient step.", ) # type: ignore[assignment] "int : Number of frames to display each gradient step." final_gradient_direction: graphics.Gradient.Direction = ArgField( cmd_name="--final-gradient-direction", - type_parser=arg_validators.GradientDirection.type_parser, + type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, - metavar=arg_validators.GradientDirection.METAVAR, + metavar=argvalidators.GradientDirection.METAVAR, help="Direction of the final gradient.", ) # type: ignore[assignment] "graphics.Gradient.Direction : Direction of the final gradient." wipe_delay: int = ArgField( cmd_name="--wipe-delay", - type_parser=arg_validators.NonNegativeInt.type_parser, + type_parser=argvalidators.NonNegativeInt.type_parser, default=0, - metavar=arg_validators.NonNegativeInt.METAVAR, + metavar=argvalidators.NonNegativeInt.METAVAR, help="Number of frames to wait before adding the next character group. Increase, to slow down the effect.", ) # type: ignore[assignment] "int : Number of frames to wait before adding the next character group. Increase, to slow down the effect." @@ -1838,7 +2455,7 @@

    - final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=arg_validators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=arg_validators.GradientDirection.METAVAR, help='Direction of the final gradient.') + final_gradient_direction: graphics.Gradient.Direction = ArgField(cmd_name='--final-gradient-direction', type_parser=argvalidators.GradientDirection.type_parser, default=graphics.Gradient.Direction.VERTICAL, metavar=argvalidators.GradientDirection.METAVAR, help='Direction of the final gradient.') class-attribute @@ -1860,7 +2477,7 @@

    - final_gradient_frames: int = ArgField(cmd_name='--final-gradient-frames', type_parser=arg_validators.PositiveInt.type_parser, default=5, metavar=arg_validators.PositiveInt.METAVAR, help='Number of frames to display each gradient step.') + final_gradient_frames: int = 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.') class-attribute @@ -1882,7 +2499,7 @@

    - final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=arg_validators.PositiveInt.type_parser, nargs='+', default=(12), metavar=arg_validators.PositiveInt.METAVAR, help='Number of gradient steps to use. More steps will create a smoother and longer gradient animation.') + final_gradient_steps: tuple[int, ...] = ArgField(cmd_name='--final-gradient-steps', type_parser=argvalidators.PositiveInt.type_parser, nargs='+', default=(12), metavar=argvalidators.PositiveInt.METAVAR, help='Number of gradient steps to use. More steps will create a smoother and longer gradient animation.') class-attribute @@ -1904,7 +2521,7 @@

    - final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=arg_validators.Color.type_parser, nargs='+', default=('833ab4', 'fd1d1d', 'fcb045'), metavar=arg_validators.Color.METAVAR, help='Space separated, unquoted, list of colors for the wipe gradient.') + final_gradient_stops: tuple[graphics.Color, ...] = ArgField(cmd_name='--final-gradient-stops', type_parser=argvalidators.ColorArg.type_parser, nargs='+', default=('833ab4', 'fd1d1d', 'fcb045'), metavar=argvalidators.ColorArg.METAVAR, help='Space separated, unquoted, list of colors for the wipe gradient.') class-attribute @@ -1926,7 +2543,7 @@

    - wipe_delay: int = ArgField(cmd_name='--wipe-delay', type_parser=arg_validators.NonNegativeInt.type_parser, default=0, metavar=arg_validators.NonNegativeInt.METAVAR, help='Number of frames to wait before adding the next character group. Increase, to slow down the effect.') + wipe_delay: int = ArgField(cmd_name='--wipe-delay', type_parser=argvalidators.NonNegativeInt.type_parser, default=0, metavar=argvalidators.NonNegativeInt.METAVAR, help='Number of frames to wait before adding the next character group. Increase, to slow down the effect.') class-attribute diff --git a/engine/animation/animation/index.html b/engine/animation/animation/index.html new file mode 100755 index 00000000..5d0d39b5 --- /dev/null +++ b/engine/animation/animation/index.html @@ -0,0 +1,3699 @@ + + + + + + + + + + + + + + + + + + + + + + + Animation - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + + + + + +
    +
    + + + + +

    Animation

    +

    Module: terminaltexteffects.engine.animation

    + + +
    + + + + +
    + + +
    + Source code in terminaltexteffects/engine/animation.py +
    class Animation:
    +    def __init__(self, character: "base_character.EffectCharacter"):
    +        """Animation handles the animations of a character. It contains a scene_name -> Scene mapping and the active Scene. Calls to step_animation()
    +        progress the Scene and apply the next symbol to the character.
    +
    +        Args:
    +            character (base_character.EffectCharacter): the EffectCharacter object to animate
    +        """
    +        self.scenes: dict[str, Scene] = {}
    +        self.character = character
    +        self.active_scene: Scene | None = None
    +        self.use_xterm_colors: bool = False
    +        self.no_color: bool = False
    +        self.xterm_color_map: dict[str, int] = {}
    +        self.active_scene_current_step: int = 0
    +
    +    def new_scene(
    +        self,
    +        *,
    +        is_looping: bool = False,
    +        sync: SyncMetric | None = None,
    +        ease: easing.EasingFunction | None = None,
    +        id: str = "",
    +    ) -> Scene:
    +        """Creates a new Scene and adds it to the Animation.
    +
    +        Args:
    +            id (str): Unique name for the scene. Used to query for the scene.
    +            is_looping (bool): Whether the scene should loop.
    +            sync (SyncMetric): The type of sync to use for the scene.
    +            ease (easing.EasingFunction): The easing function to use for the scene.
    +
    +        Returns:
    +            Scene: the new Scene
    +        """
    +        if not id:
    +            found_unique = False
    +            current_id = len(self.scenes)
    +            while not found_unique:
    +                id = f"{len(self.scenes)}"
    +                if id not in self.scenes:
    +                    found_unique = True
    +                else:
    +                    current_id += 1
    +
    +        new_scene = Scene(scene_id=id, is_looping=is_looping, sync=sync, ease=ease)
    +        self.scenes[id] = new_scene
    +        new_scene.no_color = self.no_color
    +        new_scene.use_xterm_colors = self.use_xterm_colors
    +        return new_scene
    +
    +    def query_scene(self, scene_id: str) -> Scene:
    +        """Returns a Scene from the Animation. If the scene doesn't exist, raises a ValueError.
    +
    +        Args:
    +            scene_id (str): the ID of the Scene
    +
    +        Returns:
    +            Scene: the Scene
    +        """
    +        scene = self.scenes.get(scene_id, None)
    +        if not scene:
    +            raise ValueError(f"Scene {scene_id} does not exist.")
    +        return scene
    +
    +    def active_scene_is_complete(self) -> bool:
    +        """Returns whether the active scene is complete. A scene is complete if all sequences have been played.
    +        Looping scenes are always complete.
    +
    +        Returns:
    +            bool: True if complete, False otherwise
    +        """
    +        if not self.active_scene:
    +            return True
    +        elif not self.active_scene.frames or self.active_scene.is_looping:
    +            return True
    +
    +        return False
    +
    +    def set_appearance(self, symbol: str, color: str | int | None = None) -> None:
    +        """Applies a symbol and color to the character. If the character has an active scene, any appearance set with this method
    +        will be overwritten when the scene is stepped to the next frame.
    +
    +        Args:
    +            symbol (str): The symbol to apply.
    +            color (str | int | None): The color to apply.
    +        """
    +        if not self.no_color and color is not None:
    +            if self.use_xterm_colors and isinstance(color, str):
    +                if color in self.xterm_color_map:
    +                    color = self.xterm_color_map[color]
    +                else:
    +                    xterm_color = hexterm.hex_to_xterm(color)
    +                    self.xterm_color_map[color] = xterm_color
    +                    color = xterm_color
    +        else:
    +            color = None
    +        visual = CharacterVisual(symbol, color=color)
    +        self.character.symbol = visual.symbol
    +
    +    @staticmethod
    +    def random_color() -> str:
    +        """Returns a random hex color code.
    +
    +        Returns:
    +            str: hex color code
    +        """
    +        return hex(random.randint(0, 0xFFFFFF))[2:].zfill(6)
    +
    +    @staticmethod
    +    def adjust_color_brightness(color: graphics.Color, brightness: float) -> graphics.Color:
    +        """
    +        Adjusts the brightness of a given color.
    +
    +        Args:
    +            color (Color): The color code to adjust.
    +            brightness (float): The brightness adjustment factor.
    +
    +        Returns:
    +            Color: The adjusted color code.
    +        """
    +
    +        def hue_to_rgb(p, q, t):
    +            if t < 0:
    +                t += 1
    +            if t > 1:
    +                t -= 1
    +            if t < 1 / 6:
    +                return p + (q - p) * 6 * t
    +            if t < 1 / 2:
    +                return q
    +            if t < 2 / 3:
    +                return p + (q - p) * (2 / 3 - t) * 6
    +            return p
    +
    +        xterm = False
    +        if isinstance(color, int):
    +            color = hexterm.xterm_to_hex(color)
    +            xterm = True
    +
    +        # Split the hex color string into RGB components and convert to decimal
    +        r = int(color[0:2], 16) / 255
    +        g = int(color[2:4], 16) / 255
    +        b = int(color[4:6], 16) / 255
    +
    +        # Convert RGB to HSL
    +        max_val = max(r, g, b)
    +        min_val = min(r, g, b)
    +        lightness = (max_val + min_val) / 2
    +
    +        if max_val == min_val:
    +            h = s = 0.0  # achromatic
    +        else:
    +            diff = max_val - min_val
    +            s = diff / (2 - max_val - min_val) if lightness > 0.5 else diff / (max_val + min_val)
    +            if max_val == r:
    +                h = (g - b) / diff + (6 if g < b else 0)
    +            elif max_val == g:
    +                h = (b - r) / diff + 2
    +            else:
    +                h = (r - g) / diff + 4
    +            h /= 6
    +
    +        # Adjust lightness
    +        lightness = max(min(lightness * brightness, 1), 0)
    +
    +        # Convert back to RGB
    +        if s == 0:
    +            r = g = b = lightness  # achromatic
    +        else:
    +            q = lightness * (1 + s) if lightness < 0.5 else lightness + s - lightness * s
    +            p = 2 * lightness - q
    +            r = hue_to_rgb(p, q, h + 1 / 3)
    +            g = hue_to_rgb(p, q, h)
    +            b = hue_to_rgb(p, q, h - 1 / 3)
    +
    +        # Convert to hex
    +        adjusted_color = "{:02x}{:02x}{:02x}".format(int(r * 255), int(g * 255), int(b * 255))
    +        if xterm:
    +            return hexterm.hex_to_xterm(adjusted_color)
    +        return adjusted_color
    +
    +    def _ease_animation(self, easing_func: easing.EasingFunction) -> float:
    +        """Returns the percentage of total distance that should be moved based on the easing function.
    +
    +        Args:
    +            easing_func (easing.EasingFunction): The easing function to use.
    +
    +        Returns:
    +            float: The percentage of total distance to move.
    +        """
    +
    +        if self.active_scene is None:
    +            return 0
    +        elapsed_step_ratio = self.active_scene.easing_current_step / self.active_scene.easing_total_steps
    +        return easing_func(elapsed_step_ratio)
    +
    +    def step_animation(self) -> None:
    +        """Apply the next symbol in the scene to the character. If a scene order exists, the next scene
    +        will be activated when the current scene is complete."""
    +        if self.active_scene and self.active_scene.frames:
    +            # if the active scene is synced to movement, calculate the sequence index based on the
    +            # current waypoint progress
    +            if self.active_scene.sync:
    +                if self.character.motion.active_path:
    +                    if self.active_scene.sync == SyncMetric.STEP:
    +                        sequence_index = round(
    +                            (len(self.active_scene.frames) - 1)
    +                            * (
    +                                max(self.character.motion.active_path.current_step, 1)
    +                                / max(self.character.motion.active_path.max_steps, 1)
    +                            )
    +                        )
    +                    elif self.active_scene.sync == SyncMetric.DISTANCE:
    +                        sequence_index = round(
    +                            (len(self.active_scene.frames) - 1)
    +                            * (
    +                                max(
    +                                    max(self.character.motion.active_path.total_distance, 1)
    +                                    - max(
    +                                        self.character.motion.active_path.total_distance
    +                                        - self.character.motion.active_path.last_distance_reached,
    +                                        1,
    +                                    ),
    +                                    1,
    +                                )
    +                                / max(self.character.motion.active_path.total_distance, 1)
    +                            )
    +                        )
    +                    try:
    +                        self.character.symbol = self.active_scene.frames[sequence_index].symbol
    +                    except IndexError:
    +                        self.character.symbol = self.active_scene.frames[-1].symbol
    +                else:  # when the active waypoint has been deactivated, use the final symbol in the scene and finish the scene
    +                    self.character.symbol = self.active_scene.frames[-1].symbol
    +                    self.active_scene.played_frames.extend(self.active_scene.frames)
    +                    self.active_scene.frames.clear()
    +
    +            elif self.active_scene and self.active_scene.ease:
    +                easing_factor = self._ease_animation(self.active_scene.ease)
    +                frame_index = round(easing_factor * max(self.active_scene.easing_total_steps - 1, 0))
    +                frame_index = max(min(frame_index, self.active_scene.easing_total_steps - 1), 0)
    +                frame = self.active_scene.frame_index_map[frame_index]
    +                self.character.symbol = frame.symbol
    +                self.active_scene.easing_current_step += 1
    +                if self.active_scene.easing_current_step == self.active_scene.easing_total_steps:
    +                    if self.active_scene.is_looping:
    +                        self.active_scene.easing_current_step = 0
    +                    else:
    +                        self.active_scene.played_frames.extend(self.active_scene.frames)
    +                        self.active_scene.frames.clear()
    +
    +            else:
    +                self.character.symbol = self.active_scene.get_next_symbol()
    +            if self.active_scene_is_complete():
    +                completed_scene = self.active_scene
    +                if not self.active_scene.is_looping:
    +                    self.active_scene.reset_scene()
    +                    self.active_scene = None
    +
    +                self.character.event_handler._handle_event(
    +                    self.character.event_handler.Event.SCENE_COMPLETE, completed_scene
    +                )
    +
    +    def activate_scene(self, scene: Scene) -> None:
    +        """Sets the active scene.
    +
    +        Args:
    +            scene (Scene): the Scene to set as active
    +        """
    +        self.active_scene = scene
    +        self.active_scene_current_step = 0
    +        self.character.symbol = self.active_scene.activate()
    +        self.character.event_handler._handle_event(self.character.event_handler.Event.SCENE_ACTIVATED, scene)
    +
    +    def deactivate_scene(self, scene: Scene) -> None:
    +        """Deactivates a scene.
    +
    +        Args:
    +            scene (Scene): the Scene to deactivate
    +        """
    +        if self.active_scene is scene:
    +            self.active_scene = None
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + __init__(character) + +

    + + +
    + +

    Animation handles the animations of a character. It contains a scene_name -> Scene mapping and the active Scene. Calls to step_animation() +progress the Scene and apply the next symbol to the character.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    character + EffectCharacter + +
    +

    the EffectCharacter object to animate

    +
    +
    + required +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def __init__(self, character: "base_character.EffectCharacter"):
    +    """Animation handles the animations of a character. It contains a scene_name -> Scene mapping and the active Scene. Calls to step_animation()
    +    progress the Scene and apply the next symbol to the character.
    +
    +    Args:
    +        character (base_character.EffectCharacter): the EffectCharacter object to animate
    +    """
    +    self.scenes: dict[str, Scene] = {}
    +    self.character = character
    +    self.active_scene: Scene | None = None
    +    self.use_xterm_colors: bool = False
    +    self.no_color: bool = False
    +    self.xterm_color_map: dict[str, int] = {}
    +    self.active_scene_current_step: int = 0
    +
    +
    +
    + +
    + + +
    + + + +

    + activate_scene(scene) + +

    + + +
    + +

    Sets the active scene.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    scene + Scene + +
    +

    the Scene to set as active

    +
    +
    + required +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def activate_scene(self, scene: Scene) -> None:
    +    """Sets the active scene.
    +
    +    Args:
    +        scene (Scene): the Scene to set as active
    +    """
    +    self.active_scene = scene
    +    self.active_scene_current_step = 0
    +    self.character.symbol = self.active_scene.activate()
    +    self.character.event_handler._handle_event(self.character.event_handler.Event.SCENE_ACTIVATED, scene)
    +
    +
    +
    + +
    + + +
    + + + +

    + active_scene_is_complete() + +

    + + +
    + +

    Returns whether the active scene is complete. A scene is complete if all sequences have been played. +Looping scenes are always complete.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    bool + bool + +
    +

    True if complete, False otherwise

    +
    +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def active_scene_is_complete(self) -> bool:
    +    """Returns whether the active scene is complete. A scene is complete if all sequences have been played.
    +    Looping scenes are always complete.
    +
    +    Returns:
    +        bool: True if complete, False otherwise
    +    """
    +    if not self.active_scene:
    +        return True
    +    elif not self.active_scene.frames or self.active_scene.is_looping:
    +        return True
    +
    +    return False
    +
    +
    +
    + +
    + + +
    + + + +

    + adjust_color_brightness(color, brightness) + + + staticmethod + + +

    + + +
    + +

    Adjusts the brightness of a given color.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    color + Color + +
    +

    The color code to adjust.

    +
    +
    + required +
    brightness + float + +
    +

    The brightness adjustment factor.

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Color + Color + +
    +

    The adjusted color code.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    @staticmethod
    +def adjust_color_brightness(color: graphics.Color, brightness: float) -> graphics.Color:
    +    """
    +    Adjusts the brightness of a given color.
    +
    +    Args:
    +        color (Color): The color code to adjust.
    +        brightness (float): The brightness adjustment factor.
    +
    +    Returns:
    +        Color: The adjusted color code.
    +    """
    +
    +    def hue_to_rgb(p, q, t):
    +        if t < 0:
    +            t += 1
    +        if t > 1:
    +            t -= 1
    +        if t < 1 / 6:
    +            return p + (q - p) * 6 * t
    +        if t < 1 / 2:
    +            return q
    +        if t < 2 / 3:
    +            return p + (q - p) * (2 / 3 - t) * 6
    +        return p
    +
    +    xterm = False
    +    if isinstance(color, int):
    +        color = hexterm.xterm_to_hex(color)
    +        xterm = True
    +
    +    # Split the hex color string into RGB components and convert to decimal
    +    r = int(color[0:2], 16) / 255
    +    g = int(color[2:4], 16) / 255
    +    b = int(color[4:6], 16) / 255
    +
    +    # Convert RGB to HSL
    +    max_val = max(r, g, b)
    +    min_val = min(r, g, b)
    +    lightness = (max_val + min_val) / 2
    +
    +    if max_val == min_val:
    +        h = s = 0.0  # achromatic
    +    else:
    +        diff = max_val - min_val
    +        s = diff / (2 - max_val - min_val) if lightness > 0.5 else diff / (max_val + min_val)
    +        if max_val == r:
    +            h = (g - b) / diff + (6 if g < b else 0)
    +        elif max_val == g:
    +            h = (b - r) / diff + 2
    +        else:
    +            h = (r - g) / diff + 4
    +        h /= 6
    +
    +    # Adjust lightness
    +    lightness = max(min(lightness * brightness, 1), 0)
    +
    +    # Convert back to RGB
    +    if s == 0:
    +        r = g = b = lightness  # achromatic
    +    else:
    +        q = lightness * (1 + s) if lightness < 0.5 else lightness + s - lightness * s
    +        p = 2 * lightness - q
    +        r = hue_to_rgb(p, q, h + 1 / 3)
    +        g = hue_to_rgb(p, q, h)
    +        b = hue_to_rgb(p, q, h - 1 / 3)
    +
    +    # Convert to hex
    +    adjusted_color = "{:02x}{:02x}{:02x}".format(int(r * 255), int(g * 255), int(b * 255))
    +    if xterm:
    +        return hexterm.hex_to_xterm(adjusted_color)
    +    return adjusted_color
    +
    +
    +
    + +
    + + +
    + + + +

    + deactivate_scene(scene) + +

    + + +
    + +

    Deactivates a scene.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    scene + Scene + +
    +

    the Scene to deactivate

    +
    +
    + required +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def deactivate_scene(self, scene: Scene) -> None:
    +    """Deactivates a scene.
    +
    +    Args:
    +        scene (Scene): the Scene to deactivate
    +    """
    +    if self.active_scene is scene:
    +        self.active_scene = None
    +
    +
    +
    + +
    + + +
    + + + +

    + new_scene(*, is_looping=False, sync=None, ease=None, id='') + +

    + + +
    + +

    Creates a new Scene and adds it to the Animation.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    id + str + +
    +

    Unique name for the scene. Used to query for the scene.

    +
    +
    + '' +
    is_looping + bool + +
    +

    Whether the scene should loop.

    +
    +
    + False +
    sync + SyncMetric + +
    +

    The type of sync to use for the scene.

    +
    +
    + None +
    ease + EasingFunction + +
    +

    The easing function to use for the scene.

    +
    +
    + None +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Scene + Scene + +
    +

    the new Scene

    +
    +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def new_scene(
    +    self,
    +    *,
    +    is_looping: bool = False,
    +    sync: SyncMetric | None = None,
    +    ease: easing.EasingFunction | None = None,
    +    id: str = "",
    +) -> Scene:
    +    """Creates a new Scene and adds it to the Animation.
    +
    +    Args:
    +        id (str): Unique name for the scene. Used to query for the scene.
    +        is_looping (bool): Whether the scene should loop.
    +        sync (SyncMetric): The type of sync to use for the scene.
    +        ease (easing.EasingFunction): The easing function to use for the scene.
    +
    +    Returns:
    +        Scene: the new Scene
    +    """
    +    if not id:
    +        found_unique = False
    +        current_id = len(self.scenes)
    +        while not found_unique:
    +            id = f"{len(self.scenes)}"
    +            if id not in self.scenes:
    +                found_unique = True
    +            else:
    +                current_id += 1
    +
    +    new_scene = Scene(scene_id=id, is_looping=is_looping, sync=sync, ease=ease)
    +    self.scenes[id] = new_scene
    +    new_scene.no_color = self.no_color
    +    new_scene.use_xterm_colors = self.use_xterm_colors
    +    return new_scene
    +
    +
    +
    + +
    + + +
    + + + +

    + query_scene(scene_id) + +

    + + +
    + +

    Returns a Scene from the Animation. If the scene doesn't exist, raises a ValueError.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    scene_id + str + +
    +

    the ID of the Scene

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Scene + Scene + +
    +

    the Scene

    +
    +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def query_scene(self, scene_id: str) -> Scene:
    +    """Returns a Scene from the Animation. If the scene doesn't exist, raises a ValueError.
    +
    +    Args:
    +        scene_id (str): the ID of the Scene
    +
    +    Returns:
    +        Scene: the Scene
    +    """
    +    scene = self.scenes.get(scene_id, None)
    +    if not scene:
    +        raise ValueError(f"Scene {scene_id} does not exist.")
    +    return scene
    +
    +
    +
    + +
    + + +
    + + + +

    + random_color() + + + staticmethod + + +

    + + +
    + +

    Returns a random hex color code.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    hex color code

    +
    +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    @staticmethod
    +def random_color() -> str:
    +    """Returns a random hex color code.
    +
    +    Returns:
    +        str: hex color code
    +    """
    +    return hex(random.randint(0, 0xFFFFFF))[2:].zfill(6)
    +
    +
    +
    + +
    + + +
    + + + +

    + set_appearance(symbol, color=None) + +

    + + +
    + +

    Applies a symbol and color to the character. If the character has an active scene, any appearance set with this method +will be overwritten when the scene is stepped to the next frame.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    symbol + str + +
    +

    The symbol to apply.

    +
    +
    + required +
    color + str | int | None + +
    +

    The color to apply.

    +
    +
    + None +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def set_appearance(self, symbol: str, color: str | int | None = None) -> None:
    +    """Applies a symbol and color to the character. If the character has an active scene, any appearance set with this method
    +    will be overwritten when the scene is stepped to the next frame.
    +
    +    Args:
    +        symbol (str): The symbol to apply.
    +        color (str | int | None): The color to apply.
    +    """
    +    if not self.no_color and color is not None:
    +        if self.use_xterm_colors and isinstance(color, str):
    +            if color in self.xterm_color_map:
    +                color = self.xterm_color_map[color]
    +            else:
    +                xterm_color = hexterm.hex_to_xterm(color)
    +                self.xterm_color_map[color] = xterm_color
    +                color = xterm_color
    +    else:
    +        color = None
    +    visual = CharacterVisual(symbol, color=color)
    +    self.character.symbol = visual.symbol
    +
    +
    +
    + +
    + + +
    + + + +

    + step_animation() + +

    + + +
    + +

    Apply the next symbol in the scene to the character. If a scene order exists, the next scene +will be activated when the current scene is complete.

    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def step_animation(self) -> None:
    +    """Apply the next symbol in the scene to the character. If a scene order exists, the next scene
    +    will be activated when the current scene is complete."""
    +    if self.active_scene and self.active_scene.frames:
    +        # if the active scene is synced to movement, calculate the sequence index based on the
    +        # current waypoint progress
    +        if self.active_scene.sync:
    +            if self.character.motion.active_path:
    +                if self.active_scene.sync == SyncMetric.STEP:
    +                    sequence_index = round(
    +                        (len(self.active_scene.frames) - 1)
    +                        * (
    +                            max(self.character.motion.active_path.current_step, 1)
    +                            / max(self.character.motion.active_path.max_steps, 1)
    +                        )
    +                    )
    +                elif self.active_scene.sync == SyncMetric.DISTANCE:
    +                    sequence_index = round(
    +                        (len(self.active_scene.frames) - 1)
    +                        * (
    +                            max(
    +                                max(self.character.motion.active_path.total_distance, 1)
    +                                - max(
    +                                    self.character.motion.active_path.total_distance
    +                                    - self.character.motion.active_path.last_distance_reached,
    +                                    1,
    +                                ),
    +                                1,
    +                            )
    +                            / max(self.character.motion.active_path.total_distance, 1)
    +                        )
    +                    )
    +                try:
    +                    self.character.symbol = self.active_scene.frames[sequence_index].symbol
    +                except IndexError:
    +                    self.character.symbol = self.active_scene.frames[-1].symbol
    +            else:  # when the active waypoint has been deactivated, use the final symbol in the scene and finish the scene
    +                self.character.symbol = self.active_scene.frames[-1].symbol
    +                self.active_scene.played_frames.extend(self.active_scene.frames)
    +                self.active_scene.frames.clear()
    +
    +        elif self.active_scene and self.active_scene.ease:
    +            easing_factor = self._ease_animation(self.active_scene.ease)
    +            frame_index = round(easing_factor * max(self.active_scene.easing_total_steps - 1, 0))
    +            frame_index = max(min(frame_index, self.active_scene.easing_total_steps - 1), 0)
    +            frame = self.active_scene.frame_index_map[frame_index]
    +            self.character.symbol = frame.symbol
    +            self.active_scene.easing_current_step += 1
    +            if self.active_scene.easing_current_step == self.active_scene.easing_total_steps:
    +                if self.active_scene.is_looping:
    +                    self.active_scene.easing_current_step = 0
    +                else:
    +                    self.active_scene.played_frames.extend(self.active_scene.frames)
    +                    self.active_scene.frames.clear()
    +
    +        else:
    +            self.character.symbol = self.active_scene.get_next_symbol()
    +        if self.active_scene_is_complete():
    +            completed_scene = self.active_scene
    +            if not self.active_scene.is_looping:
    +                self.active_scene.reset_scene()
    +                self.active_scene = None
    +
    +            self.character.event_handler._handle_event(
    +                self.character.event_handler.Event.SCENE_COMPLETE, completed_scene
    +            )
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/animation/charactervisual/index.html b/engine/animation/charactervisual/index.html new file mode 100755 index 00000000..eb88680f --- /dev/null +++ b/engine/animation/charactervisual/index.html @@ -0,0 +1,2231 @@ + + + + + + + + + + + + + + + + + + + + + + + CharacterVisual - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    CharacterVisual

    +

    Module: terminaltexteffects.engine.animation

    + + +
    + + + + +
    + + +

    A class for storing symbol, color, and terminal graphical modes for the character.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    symbol + str + +
    +

    the symbol to show

    +
    +
    + required +
    bold + bool + +
    +

    bold mode

    +
    +
    + False +
    dim + bool + +
    +

    dim mode

    +
    +
    + False +
    italic + bool + +
    +

    italic mode

    +
    +
    + False +
    underline + bool + +
    +

    underline mode

    +
    +
    + False +
    blink + bool + +
    +

    blink mode

    +
    +
    + False +
    reverse + bool + +
    +

    reverse mode

    +
    +
    + False +
    hidden + bool + +
    +

    hidden mode

    +
    +
    + False +
    strike + bool + +
    +

    strike mode

    +
    +
    + False +
    color + Color + +
    +

    color code

    +
    +
    + None +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    24
    +25
    +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
    @dataclass
    +class CharacterVisual:
    +    """A class for storing symbol, color, and terminal graphical modes for the character.
    +
    +    Args:
    +        symbol (str): the symbol to show
    +        bold (bool): bold mode
    +        dim (bool): dim mode
    +        italic (bool): italic mode
    +        underline (bool): underline mode
    +        blink (bool): blink mode
    +        reverse (bool): reverse mode
    +        hidden (bool): hidden mode
    +        strike (bool): strike mode
    +        color (Color): color code
    +    """
    +
    +    symbol: str
    +    bold: bool = False
    +    dim: bool = False
    +    italic: bool = False
    +    underline: bool = False
    +    blink: bool = False
    +    reverse: bool = False
    +    hidden: bool = False
    +    strike: bool = False
    +    color: graphics.Color | None = None
    +
    +    def __post_init__(self):
    +        self.format_symbol()
    +
    +    def disable_modes(self) -> None:
    +        """Disables all graphical modes."""
    +        self.bold = False
    +        self.dim = False
    +        self.italic = False
    +        self.underline = False
    +        self.blink = False
    +        self.reverse = False
    +        self.hidden = False
    +        self.strike = False
    +
    +    def format_symbol(self) -> None:
    +        """Formats the symbol for printing by applying ANSI sequences for any active modes and color."""
    +        formatting_string = ""
    +        if self.bold:
    +            formatting_string += ansitools.APPLY_BOLD()
    +        if self.italic:
    +            formatting_string += ansitools.APPLY_ITALIC()
    +        if self.underline:
    +            formatting_string += ansitools.APPLY_UNDERLINE()
    +        if self.blink:
    +            formatting_string += ansitools.APPLY_BLINK()
    +        if self.reverse:
    +            formatting_string += ansitools.APPLY_REVERSE()
    +        if self.hidden:
    +            formatting_string += ansitools.APPLY_HIDDEN()
    +        if self.strike:
    +            formatting_string += ansitools.APPLY_STRIKETHROUGH()
    +        if self.color is not None:
    +            formatting_string += colorterm.fg(self.color)
    +
    +        self.symbol = f"{formatting_string}{self.symbol}{ansitools.RESET_ALL() if formatting_string else ''}"
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + disable_modes() + +

    + + +
    + +

    Disables all graphical modes.

    + +
    + Source code in terminaltexteffects/engine/animation.py +
    55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    def disable_modes(self) -> None:
    +    """Disables all graphical modes."""
    +    self.bold = False
    +    self.dim = False
    +    self.italic = False
    +    self.underline = False
    +    self.blink = False
    +    self.reverse = False
    +    self.hidden = False
    +    self.strike = False
    +
    +
    +
    + +
    + + +
    + + + +

    + format_symbol() + +

    + + +
    + +

    Formats the symbol for printing by applying ANSI sequences for any active modes and color.

    + +
    + Source code in terminaltexteffects/engine/animation.py +
    66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    def format_symbol(self) -> None:
    +    """Formats the symbol for printing by applying ANSI sequences for any active modes and color."""
    +    formatting_string = ""
    +    if self.bold:
    +        formatting_string += ansitools.APPLY_BOLD()
    +    if self.italic:
    +        formatting_string += ansitools.APPLY_ITALIC()
    +    if self.underline:
    +        formatting_string += ansitools.APPLY_UNDERLINE()
    +    if self.blink:
    +        formatting_string += ansitools.APPLY_BLINK()
    +    if self.reverse:
    +        formatting_string += ansitools.APPLY_REVERSE()
    +    if self.hidden:
    +        formatting_string += ansitools.APPLY_HIDDEN()
    +    if self.strike:
    +        formatting_string += ansitools.APPLY_STRIKETHROUGH()
    +    if self.color is not None:
    +        formatting_string += colorterm.fg(self.color)
    +
    +    self.symbol = f"{formatting_string}{self.symbol}{ansitools.RESET_ALL() if formatting_string else ''}"
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/animation/frame/index.html b/engine/animation/frame/index.html new file mode 100755 index 00000000..a3200ba4 --- /dev/null +++ b/engine/animation/frame/index.html @@ -0,0 +1,1881 @@ + + + + + + + + + + + + + + + + + + + + + + + Frame - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Frame

    +

    Module: terminaltexteffects.engine.animation

    + + +
    + + + + +
    + + +

    A Frame is a CharacterVisual with a duration.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    character_visual + CharacterVisual + +
    +

    a CharacterVisual object

    +
    +
    + required +
    duration + int + +
    +

    the number of frames to use the Frame

    +
    +
    + required +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    @dataclass
    +class Frame:
    +    """A Frame is a CharacterVisual with a duration.
    +
    +    Args:
    +        character_visual (CharacterVisual): a CharacterVisual object
    +        duration (int): the number of frames to use the Frame
    +    """
    +
    +    character_visual: CharacterVisual
    +    duration: int
    +
    +    def __post_init__(self):
    +        self.frames_played = 0
    +        self.symbol = self.character_visual.symbol
    +
    +
    + + + +
    + + + + + + + + + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/animation/scene/index.html b/engine/animation/scene/index.html new file mode 100755 index 00000000..7fdf75d0 --- /dev/null +++ b/engine/animation/scene/index.html @@ -0,0 +1,3268 @@ + + + + + + + + + + + + + + + + + + + + + + + Scene - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Scene

    +

    Module: terminaltexteffects.engine.animation

    + + +
    + + + + +
    + + +

    A Scene is a collection of Frames that can be played in sequence. Scenes can be looped and synced to movement.

    + + + +

    Methods:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameDescription
    add_frame +
    +

    Adds a Frame to the Scene.

    +
    +
    activate +
    +

    Activates the Scene.

    +
    +
    get_next_symbol +
    +

    Returns the next symbol in the Scene.

    +
    +
    apply_gradient_to_symbols +
    +

    Applies a gradient effect to a sequence of symbols.

    +
    +
    reset_scene +
    +

    Resets the Scene.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    class Scene:
    +    """A Scene is a collection of Frames that can be played in sequence. Scenes can be looped and synced to movement.
    +
    +    Methods:
    +        add_frame: Adds a Frame to the Scene.
    +        activate: Activates the Scene.
    +        get_next_symbol: Returns the next symbol in the Scene.
    +        apply_gradient_to_symbols: Applies a gradient effect to a sequence of symbols.
    +        reset_scene: Resets the Scene.
    +    """
    +
    +    xterm_color_map: dict[str, int] = {}
    +
    +    def __init__(
    +        self,
    +        scene_id: str,
    +        is_looping: bool = False,
    +        sync: SyncMetric | None = None,
    +        ease: easing.EasingFunction | None = None,
    +        no_color: bool = False,
    +        use_xterm_colors: bool = False,
    +    ):
    +        """Initializes a Scene.
    +
    +        Args:
    +            scene_id (str): the ID of the Scene
    +            is_looping (bool, optional): Whether the Scene should loop. Defaults to False.
    +            sync (SyncMetric | None, optional): The type of sync to use for the Scene. Defaults to None.
    +            ease (easing.EasingFunction | None, optional): The easing function to use for the Scene. Defaults to None.
    +            no_color (bool, optional): Whether to colors should be ignored. Defaults to False.
    +            use_xterm_colors (bool, optional): Whether to convert all colors to XTerm-256 colors. Defaults to False.
    +        """
    +        self.scene_id = scene_id
    +        self.is_looping = is_looping
    +        self.sync: SyncMetric | None = sync
    +        self.ease: easing.EasingFunction | None = ease
    +        self.no_color = no_color
    +        self.use_xterm_colors = use_xterm_colors
    +        self.frames: list[Frame] = []
    +        self.played_frames: list[Frame] = []
    +        self.frame_index_map: dict[int, Frame] = {}
    +        self.easing_total_steps: int = 0
    +        self.easing_current_step: int = 0
    +
    +    def add_frame(
    +        self,
    +        symbol: str,
    +        duration: int,
    +        *,
    +        color: str | int | None = None,
    +        bold=False,
    +        dim=False,
    +        italic=False,
    +        underline=False,
    +        blink=False,
    +        reverse=False,
    +        hidden=False,
    +        strike=False,
    +    ) -> None:
    +        """Adds a Frame to the Scene with the given symbol, duration, color, and graphical modes.
    +
    +        Args:
    +            symbol (str): the symbol to show
    +            color (str | int): color code
    +            duration (int): the number of frames to use the Frame
    +            color (str | int | None, optional): the color to show. Defaults to None.
    +            bold (bool, optional): bold mode. Defaults to False.
    +            dim (bool, optional): dim mode. Defaults to False.
    +            italic (bool, optional): italic mode. Defaults to False.
    +            underline (bool, optional): underline mode. Defaults to False.
    +            blink (bool, optional): blink mode. Defaults to False.
    +            reverse (bool, optional): reverse mode. Defaults to False.
    +            hidden (bool, optional): hidden mode. Defaults to False.
    +            strike (bool, optional): strike mode. Defaults to False.
    +        """
    +        if not self.no_color and color is not None:
    +            if self.use_xterm_colors and isinstance(color, str):
    +                if color in self.xterm_color_map:
    +                    color = self.xterm_color_map[color]
    +                else:
    +                    xterm_color = hexterm.hex_to_xterm(color)
    +                    self.xterm_color_map[color] = xterm_color
    +                    color = xterm_color
    +        else:
    +            color = None
    +        if duration < 1:
    +            raise ValueError("duration must be greater than 0")
    +        char_vis = CharacterVisual(
    +            symbol,
    +            bold=bold,
    +            dim=dim,
    +            italic=italic,
    +            underline=underline,
    +            blink=blink,
    +            reverse=reverse,
    +            hidden=hidden,
    +            strike=strike,
    +            color=color,
    +        )
    +        frame = Frame(char_vis, duration)
    +        self.frames.append(frame)
    +        for _ in range(frame.duration):
    +            self.frame_index_map[self.easing_total_steps] = frame
    +            self.easing_total_steps += 1
    +
    +    def activate(self) -> str:
    +        """Activates the Scene by returning the first frame symbol. Called by the Animation object when the Scene is activated.
    +
    +        Raises:
    +            ValueError: if the Scene has no sequences
    +
    +        Returns:
    +            str: the next symbol in the Scene
    +        """
    +        if self.frames:
    +            return self.frames[0].symbol
    +        else:
    +            raise ValueError("Scene has no sequences.")
    +
    +    def get_next_symbol(self) -> str:
    +        """
    +        This method is used to get the next symbol in the Scene. It first retrieves the current sequence from the frames list.
    +        It then increments the 'frames_played' attribute of the current sequence. If the 'frames_played' equals the 'duration'
    +        of the current sequence, it resets 'frames_played' to 0 and moves the current sequence from the frames list to the
    +        'played_frames' list. If the Scene is set to loop and all frames have been played, it refills the frames list with the
    +        sequences from 'played_frames' and clears 'played_frames'. Finally, it returns the symbol of the current sequence.
    +
    +        Returns:
    +            str: The symbol of the current sequence in the Scene.
    +        """
    +
    +        current_sequence = self.frames[0]
    +        next_symbol = current_sequence.symbol
    +        current_sequence.frames_played += 1
    +        if current_sequence.frames_played == current_sequence.duration:
    +            current_sequence.frames_played = 0
    +            self.played_frames.append(self.frames.pop(0))
    +            if self.is_looping and not self.frames:
    +                self.frames.extend(self.played_frames)
    +                self.played_frames.clear()
    +        return next_symbol
    +
    +    def apply_gradient_to_symbols(
    +        self, gradient: graphics.Gradient, symbols: typing.Sequence[str], duration: int
    +    ) -> None:
    +        """
    +        Applies a gradient effect to a sequence of symbols and adds each symbol as a frame to the Scene.
    +
    +        This method works by iterating over the symbols and calculating a progress ratio for each symbol.
    +        This ratio is calculated by dividing the index of the current symbol (plus one) by the total number of symbols.
    +        The gradient index is then calculated by multiplying the symbol progress by the length of the gradient's spectrum.
    +        This index is used to select a color from the gradient's spectrum.
    +
    +        The method then iterates over the colors in the gradient's spectrum from the last index to the gradient index
    +        (or 1 if gradient index is 0). For each color, it calls the add_frame method, passing the symbol, duration, and color.
    +        This adds a frame to the Scene with the symbol displayed in the color from the gradient.
    +
    +        Finally, the last index is updated to the current gradient index, and the process repeats for the next symbol.
    +        This results in each symbol being displayed in a sequence of colors from the gradient, creating a gradient effect across the symbols.
    +
    +        Args:
    +            gradient (Gradient): The gradient to apply.
    +            symbols (list[str]): The list of symbols to apply the gradient to.
    +            duration (int): The duration to show each frame.
    +
    +        Returns:
    +            None
    +        """
    +        last_index = 0
    +        for symbol_index, symbol in enumerate(symbols):
    +            symbol_progress = (symbol_index + 1) / len(symbols)
    +            gradient_index = int(symbol_progress * len(gradient.spectrum))
    +            for color in gradient.spectrum[last_index : max(gradient_index, 1)]:
    +                self.add_frame(symbol, duration, color=color)
    +            last_index = gradient_index
    +
    +    def reset_scene(self) -> None:
    +        """Resets the Scene."""
    +        for sequence in self.frames:
    +            sequence.frames_played = 0
    +            self.played_frames.append(sequence)
    +        self.frames.clear()
    +        self.frames.extend(self.played_frames)
    +        self.played_frames.clear()
    +
    +    def __eq__(self, other: typing.Any):
    +        if not isinstance(other, Scene):
    +            return NotImplemented
    +        return self.scene_id == other.scene_id
    +
    +    def __hash__(self):
    +        return hash(self.scene_id)
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + __init__(scene_id, is_looping=False, sync=None, ease=None, no_color=False, use_xterm_colors=False) + +

    + + +
    + +

    Initializes a Scene.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    scene_id + str + +
    +

    the ID of the Scene

    +
    +
    + required +
    is_looping + bool + +
    +

    Whether the Scene should loop. Defaults to False.

    +
    +
    + False +
    sync + SyncMetric | None + +
    +

    The type of sync to use for the Scene. Defaults to None.

    +
    +
    + None +
    ease + EasingFunction | None + +
    +

    The easing function to use for the Scene. Defaults to None.

    +
    +
    + None +
    no_color + bool + +
    +

    Whether to colors should be ignored. Defaults to False.

    +
    +
    + False +
    use_xterm_colors + bool + +
    +

    Whether to convert all colors to XTerm-256 colors. Defaults to False.

    +
    +
    + False +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def __init__(
    +    self,
    +    scene_id: str,
    +    is_looping: bool = False,
    +    sync: SyncMetric | None = None,
    +    ease: easing.EasingFunction | None = None,
    +    no_color: bool = False,
    +    use_xterm_colors: bool = False,
    +):
    +    """Initializes a Scene.
    +
    +    Args:
    +        scene_id (str): the ID of the Scene
    +        is_looping (bool, optional): Whether the Scene should loop. Defaults to False.
    +        sync (SyncMetric | None, optional): The type of sync to use for the Scene. Defaults to None.
    +        ease (easing.EasingFunction | None, optional): The easing function to use for the Scene. Defaults to None.
    +        no_color (bool, optional): Whether to colors should be ignored. Defaults to False.
    +        use_xterm_colors (bool, optional): Whether to convert all colors to XTerm-256 colors. Defaults to False.
    +    """
    +    self.scene_id = scene_id
    +    self.is_looping = is_looping
    +    self.sync: SyncMetric | None = sync
    +    self.ease: easing.EasingFunction | None = ease
    +    self.no_color = no_color
    +    self.use_xterm_colors = use_xterm_colors
    +    self.frames: list[Frame] = []
    +    self.played_frames: list[Frame] = []
    +    self.frame_index_map: dict[int, Frame] = {}
    +    self.easing_total_steps: int = 0
    +    self.easing_current_step: int = 0
    +
    +
    +
    + +
    + + +
    + + + +

    + activate() + +

    + + +
    + +

    Activates the Scene by returning the first frame symbol. Called by the Animation object when the Scene is activated.

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ValueError + +
    +

    if the Scene has no sequences

    +
    +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    the next symbol in the Scene

    +
    +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def activate(self) -> str:
    +    """Activates the Scene by returning the first frame symbol. Called by the Animation object when the Scene is activated.
    +
    +    Raises:
    +        ValueError: if the Scene has no sequences
    +
    +    Returns:
    +        str: the next symbol in the Scene
    +    """
    +    if self.frames:
    +        return self.frames[0].symbol
    +    else:
    +        raise ValueError("Scene has no sequences.")
    +
    +
    +
    + +
    + + +
    + + + +

    + add_frame(symbol, duration, *, color=None, bold=False, dim=False, italic=False, underline=False, blink=False, reverse=False, hidden=False, strike=False) + +

    + + +
    + +

    Adds a Frame to the Scene with the given symbol, duration, color, and graphical modes.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    symbol + str + +
    +

    the symbol to show

    +
    +
    + required +
    color + str | int + +
    +

    color code

    +
    +
    + None +
    duration + int + +
    +

    the number of frames to use the Frame

    +
    +
    + required +
    color + str | int | None + +
    +

    the color to show. Defaults to None.

    +
    +
    + None +
    bold + bool + +
    +

    bold mode. Defaults to False.

    +
    +
    + False +
    dim + bool + +
    +

    dim mode. Defaults to False.

    +
    +
    + False +
    italic + bool + +
    +

    italic mode. Defaults to False.

    +
    +
    + False +
    underline + bool + +
    +

    underline mode. Defaults to False.

    +
    +
    + False +
    blink + bool + +
    +

    blink mode. Defaults to False.

    +
    +
    + False +
    reverse + bool + +
    +

    reverse mode. Defaults to False.

    +
    +
    + False +
    hidden + bool + +
    +

    hidden mode. Defaults to False.

    +
    +
    + False +
    strike + bool + +
    +

    strike mode. Defaults to False.

    +
    +
    + False +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def add_frame(
    +    self,
    +    symbol: str,
    +    duration: int,
    +    *,
    +    color: str | int | None = None,
    +    bold=False,
    +    dim=False,
    +    italic=False,
    +    underline=False,
    +    blink=False,
    +    reverse=False,
    +    hidden=False,
    +    strike=False,
    +) -> None:
    +    """Adds a Frame to the Scene with the given symbol, duration, color, and graphical modes.
    +
    +    Args:
    +        symbol (str): the symbol to show
    +        color (str | int): color code
    +        duration (int): the number of frames to use the Frame
    +        color (str | int | None, optional): the color to show. Defaults to None.
    +        bold (bool, optional): bold mode. Defaults to False.
    +        dim (bool, optional): dim mode. Defaults to False.
    +        italic (bool, optional): italic mode. Defaults to False.
    +        underline (bool, optional): underline mode. Defaults to False.
    +        blink (bool, optional): blink mode. Defaults to False.
    +        reverse (bool, optional): reverse mode. Defaults to False.
    +        hidden (bool, optional): hidden mode. Defaults to False.
    +        strike (bool, optional): strike mode. Defaults to False.
    +    """
    +    if not self.no_color and color is not None:
    +        if self.use_xterm_colors and isinstance(color, str):
    +            if color in self.xterm_color_map:
    +                color = self.xterm_color_map[color]
    +            else:
    +                xterm_color = hexterm.hex_to_xterm(color)
    +                self.xterm_color_map[color] = xterm_color
    +                color = xterm_color
    +    else:
    +        color = None
    +    if duration < 1:
    +        raise ValueError("duration must be greater than 0")
    +    char_vis = CharacterVisual(
    +        symbol,
    +        bold=bold,
    +        dim=dim,
    +        italic=italic,
    +        underline=underline,
    +        blink=blink,
    +        reverse=reverse,
    +        hidden=hidden,
    +        strike=strike,
    +        color=color,
    +    )
    +    frame = Frame(char_vis, duration)
    +    self.frames.append(frame)
    +    for _ in range(frame.duration):
    +        self.frame_index_map[self.easing_total_steps] = frame
    +        self.easing_total_steps += 1
    +
    +
    +
    + +
    + + +
    + + + +

    + apply_gradient_to_symbols(gradient, symbols, duration) + +

    + + +
    + +

    Applies a gradient effect to a sequence of symbols and adds each symbol as a frame to the Scene.

    +

    This method works by iterating over the symbols and calculating a progress ratio for each symbol. +This ratio is calculated by dividing the index of the current symbol (plus one) by the total number of symbols. +The gradient index is then calculated by multiplying the symbol progress by the length of the gradient's spectrum. +This index is used to select a color from the gradient's spectrum.

    +

    The method then iterates over the colors in the gradient's spectrum from the last index to the gradient index +(or 1 if gradient index is 0). For each color, it calls the add_frame method, passing the symbol, duration, and color. +This adds a frame to the Scene with the symbol displayed in the color from the gradient.

    +

    Finally, the last index is updated to the current gradient index, and the process repeats for the next symbol. +This results in each symbol being displayed in a sequence of colors from the gradient, creating a gradient effect across the symbols.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    gradient + Gradient + +
    +

    The gradient to apply.

    +
    +
    + required +
    symbols + list[str] + +
    +

    The list of symbols to apply the gradient to.

    +
    +
    + required +
    duration + int + +
    +

    The duration to show each frame.

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + None + +
    +

    None

    +
    +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def apply_gradient_to_symbols(
    +    self, gradient: graphics.Gradient, symbols: typing.Sequence[str], duration: int
    +) -> None:
    +    """
    +    Applies a gradient effect to a sequence of symbols and adds each symbol as a frame to the Scene.
    +
    +    This method works by iterating over the symbols and calculating a progress ratio for each symbol.
    +    This ratio is calculated by dividing the index of the current symbol (plus one) by the total number of symbols.
    +    The gradient index is then calculated by multiplying the symbol progress by the length of the gradient's spectrum.
    +    This index is used to select a color from the gradient's spectrum.
    +
    +    The method then iterates over the colors in the gradient's spectrum from the last index to the gradient index
    +    (or 1 if gradient index is 0). For each color, it calls the add_frame method, passing the symbol, duration, and color.
    +    This adds a frame to the Scene with the symbol displayed in the color from the gradient.
    +
    +    Finally, the last index is updated to the current gradient index, and the process repeats for the next symbol.
    +    This results in each symbol being displayed in a sequence of colors from the gradient, creating a gradient effect across the symbols.
    +
    +    Args:
    +        gradient (Gradient): The gradient to apply.
    +        symbols (list[str]): The list of symbols to apply the gradient to.
    +        duration (int): The duration to show each frame.
    +
    +    Returns:
    +        None
    +    """
    +    last_index = 0
    +    for symbol_index, symbol in enumerate(symbols):
    +        symbol_progress = (symbol_index + 1) / len(symbols)
    +        gradient_index = int(symbol_progress * len(gradient.spectrum))
    +        for color in gradient.spectrum[last_index : max(gradient_index, 1)]:
    +            self.add_frame(symbol, duration, color=color)
    +        last_index = gradient_index
    +
    +
    +
    + +
    + + +
    + + + +

    + get_next_symbol() + +

    + + +
    + +

    This method is used to get the next symbol in the Scene. It first retrieves the current sequence from the frames list. +It then increments the 'frames_played' attribute of the current sequence. If the 'frames_played' equals the 'duration' +of the current sequence, it resets 'frames_played' to 0 and moves the current sequence from the frames list to the +'played_frames' list. If the Scene is set to loop and all frames have been played, it refills the frames list with the +sequences from 'played_frames' and clears 'played_frames'. Finally, it returns the symbol of the current sequence.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    The symbol of the current sequence in the Scene.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def get_next_symbol(self) -> str:
    +    """
    +    This method is used to get the next symbol in the Scene. It first retrieves the current sequence from the frames list.
    +    It then increments the 'frames_played' attribute of the current sequence. If the 'frames_played' equals the 'duration'
    +    of the current sequence, it resets 'frames_played' to 0 and moves the current sequence from the frames list to the
    +    'played_frames' list. If the Scene is set to loop and all frames have been played, it refills the frames list with the
    +    sequences from 'played_frames' and clears 'played_frames'. Finally, it returns the symbol of the current sequence.
    +
    +    Returns:
    +        str: The symbol of the current sequence in the Scene.
    +    """
    +
    +    current_sequence = self.frames[0]
    +    next_symbol = current_sequence.symbol
    +    current_sequence.frames_played += 1
    +    if current_sequence.frames_played == current_sequence.duration:
    +        current_sequence.frames_played = 0
    +        self.played_frames.append(self.frames.pop(0))
    +        if self.is_looping and not self.frames:
    +            self.frames.extend(self.played_frames)
    +            self.played_frames.clear()
    +    return next_symbol
    +
    +
    +
    + +
    + + +
    + + + +

    + reset_scene() + +

    + + +
    + +

    Resets the Scene.

    + +
    + Source code in terminaltexteffects/engine/animation.py +
    def reset_scene(self) -> None:
    +    """Resets the Scene."""
    +    for sequence in self.frames:
    +        sequence.frames_played = 0
    +        self.played_frames.append(sequence)
    +    self.frames.clear()
    +    self.frames.extend(self.played_frames)
    +    self.played_frames.clear()
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/animation/syncmetric/index.html b/engine/animation/syncmetric/index.html new file mode 100755 index 00000000..62e4d135 --- /dev/null +++ b/engine/animation/syncmetric/index.html @@ -0,0 +1,1807 @@ + + + + + + + + + + + + + + + + + + + SyncMetric - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    SyncMetric

    +

    Module: terminaltexteffects.engine.animation

    + + +
    + + + + +
    +

    + Bases: Enum

    + + +

    Enum for specifying the type of sync to use for a Scene.

    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    DISTANCE + int + +
    +

    Sync to a Waypoint based on distance from the Waypoint

    +
    +
    STEP + int + +
    +

    Sync to a Waypoint based on the number of steps taken towards the Waypoint

    +
    +
    + +
    + Source code in terminaltexteffects/engine/animation.py +
    12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    class SyncMetric(Enum):
    +    """Enum for specifying the type of sync to use for a Scene.
    +
    +    Attributes:
    +        DISTANCE (int): Sync to a Waypoint based on distance from the Waypoint
    +        STEP (int): Sync to a Waypoint based on the number of steps taken towards the Waypoint
    +    """
    +
    +    DISTANCE = auto()
    +    STEP = auto()
    +
    +
    + + + +
    + + + + + + + + + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/basecharacter/index.html b/engine/basecharacter/index.html new file mode 100755 index 00000000..b55b89cd --- /dev/null +++ b/engine/basecharacter/index.html @@ -0,0 +1,2362 @@ + + + + + + + + + + + + + + + + + + + + + + + EffectCharacter - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    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:

    + + + + + + + + + + + + + +
    NameDescription
    tick +
    +

    Progress the character's animation and motion by one step.

    +
    +
    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    input_symbol + str + +
    +

    The symbol for the character in the input data.

    +
    +
    input_coord + Coord + +
    +

    The coordinate of the character in the input data.

    +
    +
    symbol + str + +
    +

    The current symbol for the character, determined by the animation units.

    +
    +
    character_id + int + +
    +

    The unique ID of the character, generated by 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.

    +
    +
    is_visible + bool + +
    +

    Whether the character is currently visible and should be printed to the terminal.

    +
    +
    layer + int + +
    +

    The layer of the character. The layer determines the order in which characters are printed.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/base_character.py +
    class EffectCharacter:
    +    """
    +    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:
    +        tick: Progress the character's animation and motion by one step.
    +
    +    Attributes:
    +        input_symbol (str): The symbol for the character in the input data.
    +        input_coord (Coord): The coordinate of the character in the input data.
    +        symbol (str): The current symbol for the character, determined by the animation units.
    +        character_id (int): The unique ID of the character, generated by the Terminal.
    +        animation (graphics.Animation): The animation object that controls the character's appearance.
    +        motion (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.
    +        is_visible (bool): Whether the character is currently visible and should be printed to the terminal.
    +        layer (int): The layer of the character. The layer determines the order in which characters are printed.
    +    """
    +
    +    def __init__(self, character_id: int, symbol: str, input_column: int, input_row: int):
    +        """Initializes the character instance with the character ID, symbol, and input coordinates.
    +
    +        Args:
    +            character_id (int): The unique ID of the character, generated by the Terminal.
    +            symbol (str): The symbol for the character in the input data.
    +            input_column (int): The column of the character in the input data.
    +            input_row (int): The row of the character in the input data.
    +        """
    +        self._character_id: int = character_id
    +        self._input_symbol: str = symbol
    +        self._input_coord: Coord = Coord(input_column, input_row)
    +        self._is_visible: bool = False
    +        self.symbol: str = symbol
    +        self.animation: animation.Animation = animation.Animation(self)
    +        self.motion: motion.Motion = motion.Motion(self)
    +        self.event_handler: EventHandler = EventHandler(self)
    +        self.layer: int = 0
    +
    +    @property
    +    def input_symbol(self) -> str:
    +        return self._input_symbol
    +
    +    @property
    +    def input_coord(self) -> Coord:
    +        return self._input_coord
    +
    +    @property
    +    def is_visible(self) -> bool:
    +        return self._is_visible
    +
    +    @property
    +    def character_id(self) -> int:
    +        return self._character_id
    +
    +    @property
    +    def is_active(self) -> bool:
    +        """Returns whether the character is currently active. A character is active if its animation or motion is not complete.
    +
    +        Returns:
    +            bool: True if the character is active, False if not.
    +        """
    +        if not self.animation.active_scene_is_complete() or not self.motion.movement_is_complete():
    +            return True
    +        return False
    +
    +    def tick(self) -> None:
    +        """Progress the character's animation and motion by one step."""
    +        self.motion.move()
    +        self.animation.step_animation()
    +
    +    def __hash__(self) -> int:
    +        return hash(self.character_id)
    +
    +    def __eq__(self, other: typing.Any) -> bool:
    +        if not isinstance(other, EffectCharacter):
    +            return NotImplemented
    +        return self.character_id == other.character_id
    +
    +
    + + + +
    + + + + + + + +
    + + + +

    + is_active: bool + + + property + + +

    + + +
    + +

    Returns whether the character is currently active. A character is active if its animation or motion is not complete.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    bool + bool + +
    +

    True if the character is active, False if not.

    +
    +
    +
    + +
    + + + + +
    + + + +

    + __init__(character_id, symbol, input_column, input_row) + +

    + + +
    + +

    Initializes the character instance with the character ID, symbol, and input coordinates.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    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 +
    def __init__(self, character_id: int, symbol: str, input_column: int, input_row: int):
    +    """Initializes the character instance with the character ID, symbol, and input coordinates.
    +
    +    Args:
    +        character_id (int): The unique ID of the character, generated by the Terminal.
    +        symbol (str): The symbol for the character in the input data.
    +        input_column (int): The column of the character in the input data.
    +        input_row (int): The row of the character in the input data.
    +    """
    +    self._character_id: int = character_id
    +    self._input_symbol: str = symbol
    +    self._input_coord: Coord = Coord(input_column, input_row)
    +    self._is_visible: bool = False
    +    self.symbol: str = symbol
    +    self.animation: animation.Animation = animation.Animation(self)
    +    self.motion: motion.Motion = motion.Motion(self)
    +    self.event_handler: EventHandler = EventHandler(self)
    +    self.layer: int = 0
    +
    +
    +
    + +
    + + +
    + + + +

    + tick() + +

    + + +
    + +

    Progress the character's animation and motion by one step.

    + +
    + Source code in terminaltexteffects/engine/base_character.py +
    def tick(self) -> None:
    +    """Progress the character's animation and motion by one step."""
    +    self.motion.move()
    +    self.animation.step_animation()
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/reference/index.html b/engine/baseeffect/index.html similarity index 53% rename from reference/index.html rename to engine/baseeffect/index.html index 4aca0996..bfb43b49 100755 --- a/reference/index.html +++ b/engine/baseeffect/index.html @@ -9,25 +9,25 @@ - + - + - + - Reference - TerminalTextEffects Docs + BaseEffect - TerminalTextEffects Docs - + - + @@ -46,9 +46,9 @@ - + - + @@ -72,7 +72,7 @@
    - + Skip to content @@ -88,7 +88,7 @@

    BaseEffectIteratorBaseEffectIterator

    An abstract base class that defines the basic structure for an iterator @@ -1237,7 +1862,7 @@

    Reference

    BaseEffectBaseEffect

    An abstract base class that defines the basic structure for an effect. Provides the __iter__ @@ -1247,23 +1872,6 @@

    Reference

    -

    Usage Example:

    -
    class MyEffectIterator(BaseEffectIterator[MyEffectConfig]):
    -    def __init__(self, effect: "MyEffect") -> None:
    -        super().__init__(effect)
    -        # Custom initialization code here
    -
    -    def __next__(self) -> str:
    -        # Custom iteration code here
    -        return next_frame
    -
    -class MyEffect(BaseEffect[MyEffectConfig]):
    -    _config_cls = MyEffectConfig
    -    _iterator_cls = MyEffectIterator
    -
    -    def __init__(self, input_data: str) -> None:
    -        super().__init__(input_data)
    -
    @@ -1280,7 +1888,7 @@

    Reference

    -

    +

    BaseEffect @@ -1289,7 +1897,7 @@

    - Bases: ABC, Generic[T]

    + Bases: ABC, Generic[T]

    Base iterable class for all effects.

    @@ -1308,7 +1916,7 @@

    input_datainput_data str
    effect_configeffect_config - T + T
    @@ -1330,9 +1938,9 @@

    terminal_configterminal_config - TerminalConfig + TerminalConfig
    @@ -1344,8 +1952,27 @@

    - Source code in terminaltexteffects/base_effect.py -
     73
    +              Source code in terminaltexteffects/engine/base_effect.py
    +              
     54
    + 55
    + 56
    + 57
    + 58
    + 59
    + 60
    + 61
    + 62
    + 63
    + 64
    + 65
    + 66
    + 67
    + 68
    + 69
    + 70
    + 71
    + 72
    + 73
      74
      75
      76
    @@ -1379,79 +2006,60 @@ 

    104 105 106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126

    class BaseEffect(ABC, Generic[T]):
    -    """Base iterable class for all effects.
    -
    -    Base class for all effects. Provides the `__iter__` method and a context manager for terminal output.
    -
    -    Attributes:
    -        input_data (str): Text to which the effect will be applied.
    -        effect_config (T): Configuration for the effect.
    -        terminal_config (TerminalConfig): Configuration for the terminal.
    -    """
    -
    -    @property
    -    @abstractmethod
    -    def _config_cls(self) -> type[T]:
    -        """Effect configuration class as a subclass of ArgsDataClass."""
    -        raise NotImplementedError
    +107
    class BaseEffect(ABC, Generic[T]):
    +    """Base iterable class for all effects.
    +
    +    Base class for all effects. Provides the `__iter__` method and a context manager for terminal output.
    +
    +    Attributes:
    +        input_data (str): Text to which the effect will be applied.
    +        effect_config (T): Configuration for the effect.
    +        terminal_config (TerminalConfig): Configuration for the terminal.
    +    """
    +
    +    @property
    +    @abstractmethod
    +    def _config_cls(self) -> type[T]:
    +        """Effect configuration class as a subclass of ArgsDataClass."""
    +        raise NotImplementedError
    +
    +    @property
    +    @abstractmethod
    +    def _iterator_cls(self) -> type[BaseEffectIterator]:
    +        """Effect iterator class as a subclass of BaseEffectIterator."""
    +        raise NotImplementedError
    +
    +    def __init__(self, input_data: str) -> None:
    +        """Initialize the effect with the input data.
    +
    +        Args:
    +            input_data (str): Text to which the effect will be applied.
    +        """
    +        self.input_data = input_data
    +        self.effect_config = self._config_cls()
    +        self.terminal_config = TerminalConfig()
    +
    +    def __iter__(self) -> BaseEffectIterator:
    +        return self._iterator_cls(self)
     
    -    @property
    -    @abstractmethod
    -    def _iterator_cls(self) -> type[BaseEffectIterator]:
    -        """Effect iterator class as a subclass of BaseEffectIterator."""
    -        raise NotImplementedError
    -
    -    def __init__(self, input_data: str) -> None:
    -        """Initialize the effect with the input data.
    -
    -        Args:
    -            input_data (str): Text to which the effect will be applied.
    -        """
    -        self.input_data = input_data
    -        self.effect_config = self._config_cls()
    -        self.terminal_config = TerminalConfig()
    -
    -    def __iter__(self) -> BaseEffectIterator:
    -        return self._iterator_cls(self)
    -
    -    @contextmanager
    -    def terminal_output(self):
    -        """Context manager for terminal output. Prepares the terminal for output and restores it after.
    -
    -        Yields:
    -            terminal (Terminal): Terminal object for output.
    -
    -        Raises:
    -            Exception: Any exception that occurs within the context manager.
    -        """
    -        terminal = Terminal(self.input_data, self.terminal_config)
    -        try:
    -            terminal.prep_outputarea()
    -            yield terminal
    -        except:  # noqa: E722
    -            raise
    -        finally:
    -            terminal.restore_cursor()
    +    @contextmanager
    +    def terminal_output(self):
    +        """Context manager for terminal output. Prepares the terminal for output and restores it after.
    +
    +        Yields:
    +            terminal (Terminal): Terminal object for output.
    +
    +        Raises:
    +            Exception: Any exception that occurs within the context manager.
    +        """
    +        terminal = Terminal(self.input_data, self.terminal_config)
    +        try:
    +            terminal.prep_outputarea()
    +            yield terminal
    +        except:  # noqa: E722
    +            raise
    +        finally:
    +            terminal.restore_cursor()
     
    @@ -1472,7 +2080,7 @@

    -

    +

    __init__(input_data)

    @@ -1513,24 +2121,24 @@

    - Source code in terminaltexteffects/base_effect.py -
    def __init__(self, input_data: str) -> None:
    -    """Initialize the effect with the input data.
    -
    -    Args:
    -        input_data (str): Text to which the effect will be applied.
    -    """
    -    self.input_data = input_data
    -    self.effect_config = self._config_cls()
    -    self.terminal_config = TerminalConfig()
    +            Source code in terminaltexteffects/engine/base_effect.py
    +            
    77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    def __init__(self, input_data: str) -> None:
    +    """Initialize the effect with the input data.
    +
    +    Args:
    +        input_data (str): Text to which the effect will be applied.
    +    """
    +    self.input_data = input_data
    +    self.effect_config = self._config_cls()
    +    self.terminal_config = TerminalConfig()
     
    @@ -1542,7 +2150,7 @@

    +

    terminal_output()

    @@ -1565,7 +2173,7 @@

    terminal - Terminal + Terminal
    @@ -1601,42 +2209,42 @@

    - Source code in terminaltexteffects/base_effect.py -
    + +
    @contextmanager
    -def terminal_output(self):
    -    """Context manager for terminal output. Prepares the terminal for output and restores it after.
    -
    -    Yields:
    -        terminal (Terminal): Terminal object for output.
    -
    -    Raises:
    -        Exception: Any exception that occurs within the context manager.
    -    """
    -    terminal = Terminal(self.input_data, self.terminal_config)
    -    try:
    -        terminal.prep_outputarea()
    -        yield terminal
    -    except:  # noqa: E722
    -        raise
    -    finally:
    -        terminal.restore_cursor()
    +            Source code in terminaltexteffects/engine/base_effect.py
    +            
    @contextmanager
    +def terminal_output(self):
    +    """Context manager for terminal output. Prepares the terminal for output and restores it after.
    +
    +    Yields:
    +        terminal (Terminal): Terminal object for output.
    +
    +    Raises:
    +        Exception: Any exception that occurs within the context manager.
    +    """
    +    terminal = Terminal(self.input_data, self.terminal_config)
    +    try:
    +        terminal.prep_outputarea()
    +        yield terminal
    +    except:  # noqa: E722
    +        raise
    +    finally:
    +        terminal.restore_cursor()
     
    @@ -1656,7 +2264,7 @@

    +

    BaseEffectIterator @@ -1665,7 +2273,7 @@

    - Bases: ABC, Generic[T]

    + Bases: ABC, Generic[T]

    Base iterator class for all effects.

    @@ -1686,7 +2294,7 @@

    effect - BaseEffect + BaseEffect
    @@ -1713,9 +2321,9 @@

    -

    _config_config - T + T
    @@ -1724,9 +2332,9 @@

    -

    _terminal_terminal - Terminal + Terminal
    @@ -1738,58 +2346,58 @@

    - Source code in terminaltexteffects/base_effect.py -
    45
    +              Source code in terminaltexteffects/engine/base_effect.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
    class BaseEffectIterator(ABC, Generic[T]):
    -    """Base iterator class for all effects.
    -
    -    Args:
    -        effect (BaseEffect): Effect to apply to the input data.
    -
    -    Attributes:
    -        _config (T): Configuration for the effect.
    -        _terminal (Terminal): Terminal to use for output.
    -    """
    -
    -    def __init__(self, effect: "BaseEffect") -> None:
    -        """Initialize the iterator with the Effect.
    -
    -        Args:
    -            effect (BaseEffect): Effect to apply to the input data.
    -        """
    -        self._config: T = deepcopy(effect.effect_config)
    -        self._terminal = Terminal(effect.input_data, deepcopy(effect.terminal_config))
    -
    -    def __iter__(self) -> "BaseEffectIterator":
    -        return self
    -
    -    @abstractmethod
    -    def __next__(self) -> str:
    -        raise NotImplementedError
    +51
    class BaseEffectIterator(ABC, Generic[T]):
    +    """Base iterator class for all effects.
    +
    +    Args:
    +        effect (BaseEffect): Effect to apply to the input data.
    +
    +    Attributes:
    +        _config (T): Configuration for the effect.
    +        _terminal (Terminal): Terminal to use for output.
    +    """
    +
    +    def __init__(self, effect: "BaseEffect") -> None:
    +        """Initialize the iterator with the Effect.
    +
    +        Args:
    +            effect (BaseEffect): Effect to apply to the input data.
    +        """
    +        self._config: T = deepcopy(effect.effect_config)
    +        self._terminal = Terminal(effect.input_data, deepcopy(effect.terminal_config))
    +
    +    def __iter__(self) -> "BaseEffectIterator":
    +        return self
    +
    +    @abstractmethod
    +    def __next__(self) -> str:
    +        raise NotImplementedError
     
    @@ -1810,7 +2418,7 @@

    +

    __init__(effect)

    @@ -1836,7 +2444,7 @@

    effect - BaseEffect + BaseEffect
    @@ -1851,22 +2459,22 @@

    - Source code in terminaltexteffects/base_effect.py -
    56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    def __init__(self, effect: "BaseEffect") -> None:
    -    """Initialize the iterator with the Effect.
    -
    -    Args:
    -        effect (BaseEffect): Effect to apply to the input data.
    -    """
    -    self._config: T = deepcopy(effect.effect_config)
    -    self._terminal = Terminal(effect.input_data, deepcopy(effect.terminal_config))
    +            Source code in terminaltexteffects/engine/base_effect.py
    +            
    37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    def __init__(self, effect: "BaseEffect") -> None:
    +    """Initialize the iterator with the Effect.
    +
    +    Args:
    +        effect (BaseEffect): Effect to apply to the input data.
    +    """
    +    self._config: T = deepcopy(effect.effect_config)
    +    self._terminal = Terminal(effect.input_data, deepcopy(effect.terminal_config))
     
    @@ -1936,10 +2544,10 @@

    {"base": "..", "features": ["content.code.copy", "content.code.annotate"], "search": "../assets/javascripts/workers/search.b8dbb3d2.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}} + - + diff --git a/engine/eventhandler/index.html b/engine/eventhandler/index.html new file mode 100755 index 00000000..1701c6af --- /dev/null +++ b/engine/eventhandler/index.html @@ -0,0 +1,3053 @@ + + + + + + + + + + + + + + + + + + + + + + + EventHandler - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    EventHandler

    +

    Module: terminaltexteffects.engine.base_character

    + + +
    + + + + +
    + + +

    Register and handle events related to a character.

    +

    Events related to character state changes (e.g. waypoint reached) can be registered with the EventHandler. +When an event is triggered, the EventHandler will take the specified action (e.g. activate a Path). +The EventHandler is used by the EffectCharacter class to handle events related to the character.

    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    character + EffectCharacter + +
    +

    The character that the EventHandler is handling events for.

    +
    +
    registered_events + dict[tuple[Event, str], list[tuple[Action, str]]] + +
    +

    A dictionary of registered events. +The key is a tuple of the event and the subject_id (waypoint id/scene id). +The value is a list of tuples of the action and the action target (waypoint id/scene id).

    +
    +
    layer + int + +
    +

    The layer of the character. The layer determines the order in which characters are printed.

    +
    +
    + +
    + Note +

    SEGMENT_ENTERED/EXITED events will trigger the first time the character enters or exits a segment. +If looping, each loop will trigger the event, but not backwards motion as is possible with the bounce easing functions.

    +
    +
    + Source code in terminaltexteffects/engine/base_character.py +
    class EventHandler:
    +    """Register and handle events related to a character.
    +
    +    Events related to character state changes (e.g. waypoint reached) can be registered with the EventHandler.
    +    When an event is triggered, the EventHandler will take the specified action (e.g. activate a Path).
    +    The EventHandler is used by the EffectCharacter class to handle events related to the character.
    +
    +    Attributes:
    +        character (EffectCharacter): The character that the EventHandler is handling events for.
    +        registered_events (dict[tuple[Event, str], list[tuple[Action, str]]]): A dictionary of registered events.
    +            The key is a tuple of the event and the subject_id (waypoint id/scene id).
    +            The value is a list of tuples of the action and the action target (waypoint id/scene id).
    +        layer (int): The layer of the character. The layer determines the order in which characters are printed.
    +
    +    Note:
    +        SEGMENT_ENTERED/EXITED events will trigger the first time the character enters or exits a segment.
    +        If looping, each loop will trigger the event, but not backwards motion as is possible with the bounce easing functions.
    +    """
    +
    +    def __init__(self, character: "EffectCharacter"):
    +        """Initializes the instance with the EffectCharacter object.
    +
    +        Args:
    +            character (EffectCharacter): The character for which the EventHandler is handling events.
    +        """
    +        self.character = character
    +        self.layer: int = 0
    +        self.registered_events: dict[
    +            tuple[EventHandler.Event, animation.Scene | motion.Waypoint | motion.Path],
    +            list[
    +                tuple[
    +                    EventHandler.Action,
    +                    animation.Scene | motion.Waypoint | motion.Path | int | Coord | EventHandler.Callback,
    +                ]
    +            ],
    +        ] = {}
    +
    +    class Event(Enum):
    +        """An Event that can be registered with the EventHandler.
    +
    +        Register Events with the EventHandler using the register_event method of the EventHandler class.
    +
    +        Attributes:
    +            SEGMENT_ENTERED (Event): A path segment has been entered.
    +            SEGMENT_EXITED (Event): A path segment has been exited.
    +            PATH_ACTIVATED (Event): A path has been activated.
    +            PATH_COMPLETE (Event): A path has been completed.
    +            PATH_HOLDING (Event): A path has entered the holding state.
    +            SCENE_ACTIVATED (Event): An animation scene has been activated.
    +            SCENE_COMPLETE (Event): An animation scene has completed.
    +        """
    +
    +        SEGMENT_ENTERED = auto()
    +        SEGMENT_EXITED = auto()
    +        PATH_ACTIVATED = auto()
    +        PATH_COMPLETE = auto()
    +        PATH_HOLDING = auto()
    +        SCENE_ACTIVATED = auto()
    +        SCENE_COMPLETE = auto()
    +
    +    class Action(Enum):
    +        """Actions that can be taken when an event is triggered.
    +
    +        An Action is taken when an Event is triggered. Register Actions with the EventHandler using the
    +        register_event method of the EventHandler class.
    +
    +        Attributes:
    +            ACTIVATE_PATH (Action): Activates a path. The action target is the path ID.
    +            ACTIVATE_SCENE (Action): Activates an animation scene. The action target is the scene ID.
    +            DEACTIVATE_PATH (Action): Deactivates a path. The action target is the path ID.
    +            DEACTIVATE_SCENE (Action): Deactivates an animation scene. The action target is the scene ID.
    +            SET_LAYER (Action): Sets the layer of the character. The action target is the layer number.
    +            SET_COORDINATE (Action): Sets the coordinate of the character. The action target is the coordinate.
    +            CALLBACK (Action): Calls a callback function. The action target is an EventHandler.Callback object.
    +        """
    +
    +        ACTIVATE_PATH = auto()
    +        ACTIVATE_SCENE = auto()
    +        DEACTIVATE_PATH = auto()
    +        DEACTIVATE_SCENE = auto()
    +        SET_LAYER = auto()
    +        SET_COORDINATE = auto()
    +        CALLBACK = auto()
    +
    +    @dataclass(init=False)
    +    class Callback:
    +        """A callback action target that can be taken when an event is triggered.
    +
    +        Register callback actions with the EventHandler using the register_event method of the EventHandler class.
    +
    +        """
    +
    +        callback: typing.Callable
    +        args: tuple[typing.Any, ...]
    +
    +        def __init__(self, callback: typing.Callable, *args: typing.Any):
    +            """Initializes the instance with the callback function and arguments.
    +
    +            Args:
    +                callback (typing.Callable): The callback function to call.
    +                args (tuple[typing.Any,...]): A tuple of arguments to pass to the callback function. The first argument will be the character, followed by any additional arguments.
    +            """
    +            self.callback = callback
    +            self.args = args
    +
    +    def register_event(
    +        self,
    +        event: Event,
    +        caller: animation.Scene | motion.Waypoint | motion.Path,
    +        action: Action,
    +        target: animation.Scene | motion.Waypoint | motion.Path | int | Coord | Callback,
    +    ) -> None:
    +        """Registers an event to be handled by the EventHandler.
    +
    +        Args:
    +            event (Event): The event to register.
    +            caller (animation.Scene | motion.Waypoint | motion.Path): The object that triggers the event.
    +            action (Action): The action to take when the event is triggered.
    +            target (animation.Scene | motion.Waypoint | motion.Path | int | Coord | Callback): The target of the action.
    +
    +        Example:
    +            Register an event to activate a scene when a Path is complete:
    +            `event_handler.register_event(EventHandler.Event.PATH_COMPLETE, some_path, EventHandler.Action.ACTIVATE_SCENE, some_scene)`
    +        """
    +        new_event = (event, caller)
    +        new_action = (action, target)
    +        if new_event not in self.registered_events:
    +            self.registered_events[new_event] = list()
    +        self.registered_events[new_event].append(new_action)
    +
    +    def _handle_event(self, event: Event, caller: animation.Scene | motion.Waypoint | motion.Path) -> None:
    +        """Handles an event by taking the specified action.
    +
    +        Args:
    +            event (Event): An event to handle. If the event is not registered, nothing happens.
    +            caller (animation.Scene | motion.Waypoint | motion.Path): The object triggering the call.
    +        """
    +        action_map = {
    +            EventHandler.Action.ACTIVATE_PATH: self.character.motion.activate_path,
    +            EventHandler.Action.ACTIVATE_SCENE: self.character.animation.activate_scene,
    +            EventHandler.Action.DEACTIVATE_PATH: self.character.motion.deactivate_path,
    +            EventHandler.Action.DEACTIVATE_SCENE: self.character.animation.deactivate_scene,
    +            EventHandler.Action.SET_LAYER: lambda layer: setattr(self.character, "layer", layer),
    +            EventHandler.Action.SET_COORDINATE: lambda coord: setattr(self.character.motion, "current_coord", coord),
    +            EventHandler.Action.CALLBACK: lambda callback: callback.callback(self.character, *callback.args),
    +        }
    +
    +        if (event, caller) not in self.registered_events:
    +            return
    +        for event_action in self.registered_events[(event, caller)]:
    +            action, target = event_action
    +            action_map[action](target)  # type: ignore
    +
    +
    + + + +
    + + + + + + + + +
    + + + +

    + Action + + +

    + + +
    +

    + Bases: Enum

    + + +

    Actions that can be taken when an event is triggered.

    +

    An Action is taken when an Event is triggered. Register Actions with the EventHandler using the +register_event method of the EventHandler class.

    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    ACTIVATE_PATH + Action + +
    +

    Activates a path. The action target is the path ID.

    +
    +
    ACTIVATE_SCENE + Action + +
    +

    Activates an animation scene. The action target is the scene ID.

    +
    +
    DEACTIVATE_PATH + Action + +
    +

    Deactivates a path. The action target is the path ID.

    +
    +
    DEACTIVATE_SCENE + Action + +
    +

    Deactivates an animation scene. The action target is the scene ID.

    +
    +
    SET_LAYER + Action + +
    +

    Sets the layer of the character. The action target is the layer number.

    +
    +
    SET_COORDINATE + Action + +
    +

    Sets the coordinate of the character. The action target is the coordinate.

    +
    +
    CALLBACK + Action + +
    +

    Calls a callback function. The action target is an EventHandler.Callback object.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/base_character.py +
    71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    class Action(Enum):
    +    """Actions that can be taken when an event is triggered.
    +
    +    An Action is taken when an Event is triggered. Register Actions with the EventHandler using the
    +    register_event method of the EventHandler class.
    +
    +    Attributes:
    +        ACTIVATE_PATH (Action): Activates a path. The action target is the path ID.
    +        ACTIVATE_SCENE (Action): Activates an animation scene. The action target is the scene ID.
    +        DEACTIVATE_PATH (Action): Deactivates a path. The action target is the path ID.
    +        DEACTIVATE_SCENE (Action): Deactivates an animation scene. The action target is the scene ID.
    +        SET_LAYER (Action): Sets the layer of the character. The action target is the layer number.
    +        SET_COORDINATE (Action): Sets the coordinate of the character. The action target is the coordinate.
    +        CALLBACK (Action): Calls a callback function. The action target is an EventHandler.Callback object.
    +    """
    +
    +    ACTIVATE_PATH = auto()
    +    ACTIVATE_SCENE = auto()
    +    DEACTIVATE_PATH = auto()
    +    DEACTIVATE_SCENE = auto()
    +    SET_LAYER = auto()
    +    SET_COORDINATE = auto()
    +    CALLBACK = auto()
    +
    +
    + + + +
    + + + + + + + + + + + +
    + +
    + + +
    + +
    + + + +

    + Callback + + + + dataclass + + +

    + + +
    + + +

    A callback action target that can be taken when an event is triggered.

    +

    Register callback actions with the EventHandler using the register_event method of the EventHandler class.

    + +
    + Source code in terminaltexteffects/engine/base_character.py +
    @dataclass(init=False)
    +class Callback:
    +    """A callback action target that can be taken when an event is triggered.
    +
    +    Register callback actions with the EventHandler using the register_event method of the EventHandler class.
    +
    +    """
    +
    +    callback: typing.Callable
    +    args: tuple[typing.Any, ...]
    +
    +    def __init__(self, callback: typing.Callable, *args: typing.Any):
    +        """Initializes the instance with the callback function and arguments.
    +
    +        Args:
    +            callback (typing.Callable): The callback function to call.
    +            args (tuple[typing.Any,...]): A tuple of arguments to pass to the callback function. The first argument will be the character, followed by any additional arguments.
    +        """
    +        self.callback = callback
    +        self.args = args
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + __init__(callback, *args) + +

    + + +
    + +

    Initializes the instance with the callback function and arguments.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    callback + Callable + +
    +

    The callback function to call.

    +
    +
    + required +
    args + tuple[Any, ...] + +
    +

    A tuple of arguments to pass to the callback function. The first argument will be the character, followed by any additional arguments.

    +
    +
    + () +
    + +
    + Source code in terminaltexteffects/engine/base_character.py +
    def __init__(self, callback: typing.Callable, *args: typing.Any):
    +    """Initializes the instance with the callback function and arguments.
    +
    +    Args:
    +        callback (typing.Callable): The callback function to call.
    +        args (tuple[typing.Any,...]): A tuple of arguments to pass to the callback function. The first argument will be the character, followed by any additional arguments.
    +    """
    +    self.callback = callback
    +    self.args = args
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + Event + + +

    + + +
    +

    + Bases: Enum

    + + +

    An Event that can be registered with the EventHandler.

    +

    Register Events with the EventHandler using the register_event method of the EventHandler class.

    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    SEGMENT_ENTERED + Event + +
    +

    A path segment has been entered.

    +
    +
    SEGMENT_EXITED + Event + +
    +

    A path segment has been exited.

    +
    +
    PATH_ACTIVATED + Event + +
    +

    A path has been activated.

    +
    +
    PATH_COMPLETE + Event + +
    +

    A path has been completed.

    +
    +
    PATH_HOLDING + Event + +
    +

    A path has entered the holding state.

    +
    +
    SCENE_ACTIVATED + Event + +
    +

    An animation scene has been activated.

    +
    +
    SCENE_COMPLETE + Event + +
    +

    An animation scene has completed.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/base_character.py +
    48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    class Event(Enum):
    +    """An Event that can be registered with the EventHandler.
    +
    +    Register Events with the EventHandler using the register_event method of the EventHandler class.
    +
    +    Attributes:
    +        SEGMENT_ENTERED (Event): A path segment has been entered.
    +        SEGMENT_EXITED (Event): A path segment has been exited.
    +        PATH_ACTIVATED (Event): A path has been activated.
    +        PATH_COMPLETE (Event): A path has been completed.
    +        PATH_HOLDING (Event): A path has entered the holding state.
    +        SCENE_ACTIVATED (Event): An animation scene has been activated.
    +        SCENE_COMPLETE (Event): An animation scene has completed.
    +    """
    +
    +    SEGMENT_ENTERED = auto()
    +    SEGMENT_EXITED = auto()
    +    PATH_ACTIVATED = auto()
    +    PATH_COMPLETE = auto()
    +    PATH_HOLDING = auto()
    +    SCENE_ACTIVATED = auto()
    +    SCENE_COMPLETE = auto()
    +
    +
    + + + +
    + + + + + + + + + + + +
    + +
    + + +
    + + + +
    + + + +

    + __init__(character) + +

    + + +
    + +

    Initializes the instance with the EffectCharacter object.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    character + EffectCharacter + +
    +

    The character for which the EventHandler is handling events.

    +
    +
    + required +
    + +
    + Source code in terminaltexteffects/engine/base_character.py +
    30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    def __init__(self, character: "EffectCharacter"):
    +    """Initializes the instance with the EffectCharacter object.
    +
    +    Args:
    +        character (EffectCharacter): The character for which the EventHandler is handling events.
    +    """
    +    self.character = character
    +    self.layer: int = 0
    +    self.registered_events: dict[
    +        tuple[EventHandler.Event, animation.Scene | motion.Waypoint | motion.Path],
    +        list[
    +            tuple[
    +                EventHandler.Action,
    +                animation.Scene | motion.Waypoint | motion.Path | int | Coord | EventHandler.Callback,
    +            ]
    +        ],
    +    ] = {}
    +
    +
    +
    + +
    + + +
    + + + +

    + register_event(event, caller, action, target) + +

    + + +
    + +

    Registers an event to be handled by the EventHandler.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    event + Event + +
    +

    The event to register.

    +
    +
    + required +
    caller + Scene | Waypoint | Path + +
    +

    The object that triggers the event.

    +
    +
    + required +
    action + Action + +
    +

    The action to take when the event is triggered.

    +
    +
    + required +
    target + Scene | Waypoint | Path | int | Coord | Callback + +
    +

    The target of the action.

    +
    +
    + required +
    + +
    + Example +

    Register an event to activate a scene when a Path is complete: +event_handler.register_event(EventHandler.Event.PATH_COMPLETE, some_path, EventHandler.Action.ACTIVATE_SCENE, some_scene)

    +
    +
    + Source code in terminaltexteffects/engine/base_character.py +
    def register_event(
    +    self,
    +    event: Event,
    +    caller: animation.Scene | motion.Waypoint | motion.Path,
    +    action: Action,
    +    target: animation.Scene | motion.Waypoint | motion.Path | int | Coord | Callback,
    +) -> None:
    +    """Registers an event to be handled by the EventHandler.
    +
    +    Args:
    +        event (Event): The event to register.
    +        caller (animation.Scene | motion.Waypoint | motion.Path): The object that triggers the event.
    +        action (Action): The action to take when the event is triggered.
    +        target (animation.Scene | motion.Waypoint | motion.Path | int | Coord | Callback): The target of the action.
    +
    +    Example:
    +        Register an event to activate a scene when a Path is complete:
    +        `event_handler.register_event(EventHandler.Event.PATH_COMPLETE, some_path, EventHandler.Action.ACTIVATE_SCENE, some_scene)`
    +    """
    +    new_event = (event, caller)
    +    new_action = (action, target)
    +    if new_event not in self.registered_events:
    +        self.registered_events[new_event] = list()
    +    self.registered_events[new_event].append(new_action)
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/motion/motion/index.html b/engine/motion/motion/index.html new file mode 100755 index 00000000..e6db2a2b --- /dev/null +++ b/engine/motion/motion/index.html @@ -0,0 +1,1689 @@ + + + + + + + + + + + + + + + + + + + Motion - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Motion

    + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/motion/path/index.html b/engine/motion/path/index.html new file mode 100755 index 00000000..0327aa35 --- /dev/null +++ b/engine/motion/path/index.html @@ -0,0 +1,2865 @@ + + + + + + + + + + + + + + + + + + + + + + + Path - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Path

    +

    Module: terminaltexteffects.engine.motion

    + + +
    + + + + +
    + + +

    Represents a path consisting of multiple waypoints for motion.

    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    path_id + str + +
    +

    The unique identifier for the path.

    +
    +
    speed + float + +
    +

    speed > 0

    +
    +
    ease + EasingFunction | None + +
    +

    easing function for character movement. Defaults to None.

    +
    +
    layer + int | None + +
    +

    layer to move the character to, if None, layer is unchanged. Defaults to None.

    +
    +
    hold_time + int + +
    +

    number of frames to hold the character at the end of the path. Defaults to 0.

    +
    +
    loop + bool + +
    +

    Whether the path should loop back to the beginning. Default is False.

    +
    +
    + + + +

    Methods:

    + + + + + + + + + + + + + + + + + + + + + +
    NameDescription
    new_waypoint +
    +

    Coord, bezier_control: tuple[Coord, ...] | Coord | None = None, id: str = "") -> Waypoint: +Creates a new Waypoint and appends adds it to the Path.

    +
    +
    query_waypoint +
    +

    str) -> Waypoint: +Returns the waypoint with the given waypoint_id.

    +
    +
    step +
    +

    base_character.EventHandler) -> Coord: +Progresses to the next step along the path and returns the coordinate at that step.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/motion.py +
    @dataclass
    +class Path:
    +    """
    +    Represents a path consisting of multiple waypoints for motion.
    +
    +    Attributes:
    +        path_id (str): The unique identifier for the path.
    +        speed (float): speed > 0
    +        ease (easing.EasingFunction | None): easing function for character movement. Defaults to None.
    +        layer (int | None): layer to move the character to, if None, layer is unchanged. Defaults to None.
    +        hold_time (int): number of frames to hold the character at the end of the path. Defaults to 0.
    +        loop (bool): Whether the path should loop back to the beginning. Default is False.
    +
    +    Methods:
    +        new_waypoint(coord: Coord, bezier_control: tuple[Coord, ...] | Coord | None = None, id: str = "") -> Waypoint:
    +            Creates a new Waypoint and appends adds it to the Path.
    +        query_waypoint(waypoint_id: str) -> Waypoint:
    +            Returns the waypoint with the given waypoint_id.
    +        step(event_handler: base_character.EventHandler) -> Coord:
    +            Progresses to the next step along the path and returns the coordinate at that step.
    +    """
    +
    +    path_id: str
    +    speed: float = 1.0
    +    ease: easing.EasingFunction | None = None
    +    layer: int | None = None
    +    hold_time: int = 0
    +    loop: bool = False
    +
    +    def __post_init__(self) -> None:
    +        """
    +        Initializes the Path object and calculates the total distance and maximum steps.
    +        """
    +        self.segments: list[Segment] = []
    +        self.waypoints: list[Waypoint] = []
    +        self.waypoint_lookup: dict[str, Waypoint] = {}
    +        self.total_distance: float = 0
    +        self.current_step: int = 0
    +        self.max_steps: int = 0
    +        self.hold_time_remaining = self.hold_time
    +        self.last_distance_reached: float = 0  # used for animation syncing to distance
    +        self.origin_segment: Segment | None = None
    +        if self.speed <= 0:
    +            raise ValueError(f"({self.speed=}) Speed must be greater than 0.")
    +
    +    def new_waypoint(
    +        self,
    +        coord: Coord,
    +        *,
    +        bezier_control: tuple[Coord, ...] | Coord | None = None,
    +        id: str = "",
    +    ) -> Waypoint:
    +        """Creates a new Waypoint and appends adds it to the Path.
    +
    +        Args:
    +            id (str): Unique identifier for the waypoint. Used to query for the waypoint.
    +            coord (Coord): coordinate
    +            bezier_control (tuple[Coord, ...] | Coord | None): coordinate of the control point for a bezier curve. Defaults to None.
    +
    +        Returns:
    +            Waypoint: The new waypoint.
    +        """
    +        if not id:
    +            found_unique = False
    +            current_id = len(self.waypoints)
    +            while not found_unique:
    +                id = f"{len(self.waypoints)}"
    +                if id not in self.waypoint_lookup:
    +                    found_unique = True
    +                else:
    +                    current_id += 1
    +        new_waypoint = Waypoint(id, coord, bezier_control=bezier_control)
    +        self._add_waypoint_to_path(new_waypoint)
    +        return new_waypoint
    +
    +    def _add_waypoint_to_path(self, waypoint: Waypoint) -> None:
    +        """Adds a waypoint to the path and updates the total distance and maximum steps.
    +
    +        Args:
    +            waypoint (Waypoint): waypoint to add
    +        """
    +        self.waypoint_lookup[waypoint.waypoint_id] = waypoint
    +        self.waypoints.append(waypoint)
    +        if len(self.waypoints) < 2:
    +            return
    +
    +        if waypoint.bezier_control:
    +            distance_from_previous = geometry.find_length_of_bezier_curve(
    +                self.waypoints[-2].coord, waypoint.bezier_control, waypoint.coord
    +            )
    +        else:
    +            distance_from_previous = geometry.find_length_of_line(
    +                self.waypoints[-2].coord,
    +                waypoint.coord,
    +            )
    +        self.total_distance += distance_from_previous
    +        self.segments.append(Segment(self.waypoints[-2], waypoint, distance_from_previous))
    +        self.max_steps = round(self.total_distance / self.speed)
    +
    +    def query_waypoint(self, waypoint_id: str) -> Waypoint:
    +        """Returns the waypoint with the given waypoint_id.
    +
    +        Args:
    +            waypoint_id (str): waypoint_id
    +
    +        Returns:
    +            Waypoint: The waypoint with the given waypoint_id.
    +        """
    +        waypoint = self.waypoint_lookup.get(waypoint_id, None)
    +        if not waypoint:
    +            raise ValueError(f"Waypoint with id {waypoint_id} not found.")
    +        return waypoint
    +
    +    def step(self, event_handler: "base_character.EventHandler") -> Coord:
    +        """
    +        Progresses to the next step along the path and returns the coordinate at that step.
    +
    +        This method is called by the Motion.move() method. It calculates the next coordinate based on the current step,
    +        total distance, bezier control points, and the easing function if provided. It also handles the triggering of segment enter and exit events.
    +
    +        Args:
    +            event_handler (base_character.EventHandler): The EventHandler for the character.
    +
    +        Returns:
    +            Coord: The next coordinate on the path.
    +        """
    +        if not self.max_steps or self.current_step >= self.max_steps or not self.total_distance:
    +            # if the path has zero distance or there are no more steps, return the coordinate of the final waypoint in the path
    +            return self.segments[-1].end.coord
    +        else:
    +            self.current_step += 1
    +        if self.ease:
    +            distance_factor = self.ease(self.current_step / self.max_steps)
    +        else:
    +            distance_factor = self.current_step / self.max_steps
    +
    +        distance_to_travel = distance_factor * self.total_distance
    +        self.last_distance_reached = distance_to_travel
    +        for segment in self.segments:
    +            if distance_to_travel <= segment.distance:
    +                active_segment = segment
    +                if not segment.enter_event_triggered:
    +                    segment.enter_event_triggered = True
    +                    event_handler._handle_event(event_handler.Event.SEGMENT_ENTERED, segment.end)
    +                break
    +            distance_to_travel -= segment.distance
    +            if not segment.exit_event_triggered:
    +                segment.exit_event_triggered = True
    +                event_handler._handle_event(event_handler.Event.SEGMENT_EXITED, segment.end)
    +        else:  # if the distance_to_travel is further than the last waypoint, preserve the distance from the start of the final segment
    +            active_segment = self.segments[-1]
    +            distance_to_travel += active_segment.distance
    +        if active_segment.distance == 0:
    +            segment_distance_to_travel_factor = 0.0
    +        else:
    +            segment_distance_to_travel_factor = distance_to_travel / active_segment.distance
    +
    +        if active_segment.end.bezier_control:
    +            next_coord = geometry.find_coord_on_bezier_curve(
    +                active_segment.start.coord,
    +                active_segment.end.bezier_control,
    +                active_segment.end.coord,
    +                segment_distance_to_travel_factor,
    +            )
    +        else:
    +            next_coord = geometry.find_coord_on_line(
    +                active_segment.start.coord, active_segment.end.coord, segment_distance_to_travel_factor
    +            )
    +
    +        return next_coord
    +
    +    def __eq__(self, other: typing.Any) -> bool:
    +        if not isinstance(other, Path):
    +            return NotImplemented
    +        return self.path_id == other.path_id
    +
    +    def __hash__(self):
    +        return hash(self.path_id)
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + __post_init__() + +

    + + +
    + +

    Initializes the Path object and calculates the total distance and maximum steps.

    + +
    + Source code in terminaltexteffects/engine/motion.py +
    def __post_init__(self) -> None:
    +    """
    +    Initializes the Path object and calculates the total distance and maximum steps.
    +    """
    +    self.segments: list[Segment] = []
    +    self.waypoints: list[Waypoint] = []
    +    self.waypoint_lookup: dict[str, Waypoint] = {}
    +    self.total_distance: float = 0
    +    self.current_step: int = 0
    +    self.max_steps: int = 0
    +    self.hold_time_remaining = self.hold_time
    +    self.last_distance_reached: float = 0  # used for animation syncing to distance
    +    self.origin_segment: Segment | None = None
    +    if self.speed <= 0:
    +        raise ValueError(f"({self.speed=}) Speed must be greater than 0.")
    +
    +
    +
    + +
    + + +
    + + + +

    + new_waypoint(coord, *, bezier_control=None, id='') + +

    + + +
    + +

    Creates a new Waypoint and appends adds it to the Path.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    id + str + +
    +

    Unique identifier for the waypoint. Used to query for the waypoint.

    +
    +
    + '' +
    coord + Coord + +
    +

    coordinate

    +
    +
    + required +
    bezier_control + tuple[Coord, ...] | Coord | None + +
    +

    coordinate of the control point for a bezier curve. Defaults to None.

    +
    +
    + None +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Waypoint + Waypoint + +
    +

    The new waypoint.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/motion.py +
    def new_waypoint(
    +    self,
    +    coord: Coord,
    +    *,
    +    bezier_control: tuple[Coord, ...] | Coord | None = None,
    +    id: str = "",
    +) -> Waypoint:
    +    """Creates a new Waypoint and appends adds it to the Path.
    +
    +    Args:
    +        id (str): Unique identifier for the waypoint. Used to query for the waypoint.
    +        coord (Coord): coordinate
    +        bezier_control (tuple[Coord, ...] | Coord | None): coordinate of the control point for a bezier curve. Defaults to None.
    +
    +    Returns:
    +        Waypoint: The new waypoint.
    +    """
    +    if not id:
    +        found_unique = False
    +        current_id = len(self.waypoints)
    +        while not found_unique:
    +            id = f"{len(self.waypoints)}"
    +            if id not in self.waypoint_lookup:
    +                found_unique = True
    +            else:
    +                current_id += 1
    +    new_waypoint = Waypoint(id, coord, bezier_control=bezier_control)
    +    self._add_waypoint_to_path(new_waypoint)
    +    return new_waypoint
    +
    +
    +
    + +
    + + +
    + + + +

    + query_waypoint(waypoint_id) + +

    + + +
    + +

    Returns the waypoint with the given waypoint_id.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    waypoint_id + str + +
    +

    waypoint_id

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Waypoint + Waypoint + +
    +

    The waypoint with the given waypoint_id.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/motion.py +
    def query_waypoint(self, waypoint_id: str) -> Waypoint:
    +    """Returns the waypoint with the given waypoint_id.
    +
    +    Args:
    +        waypoint_id (str): waypoint_id
    +
    +    Returns:
    +        Waypoint: The waypoint with the given waypoint_id.
    +    """
    +    waypoint = self.waypoint_lookup.get(waypoint_id, None)
    +    if not waypoint:
    +        raise ValueError(f"Waypoint with id {waypoint_id} not found.")
    +    return waypoint
    +
    +
    +
    + +
    + + +
    + + + +

    + step(event_handler) + +

    + + +
    + +

    Progresses to the next step along the path and returns the coordinate at that step.

    +

    This method is called by the Motion.move() method. It calculates the next coordinate based on the current step, +total distance, bezier control points, and the easing function if provided. It also handles the triggering of segment enter and exit events.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    event_handler + EventHandler + +
    +

    The EventHandler for the character.

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Coord + Coord + +
    +

    The next coordinate on the path.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/motion.py +
    def step(self, event_handler: "base_character.EventHandler") -> Coord:
    +    """
    +    Progresses to the next step along the path and returns the coordinate at that step.
    +
    +    This method is called by the Motion.move() method. It calculates the next coordinate based on the current step,
    +    total distance, bezier control points, and the easing function if provided. It also handles the triggering of segment enter and exit events.
    +
    +    Args:
    +        event_handler (base_character.EventHandler): The EventHandler for the character.
    +
    +    Returns:
    +        Coord: The next coordinate on the path.
    +    """
    +    if not self.max_steps or self.current_step >= self.max_steps or not self.total_distance:
    +        # if the path has zero distance or there are no more steps, return the coordinate of the final waypoint in the path
    +        return self.segments[-1].end.coord
    +    else:
    +        self.current_step += 1
    +    if self.ease:
    +        distance_factor = self.ease(self.current_step / self.max_steps)
    +    else:
    +        distance_factor = self.current_step / self.max_steps
    +
    +    distance_to_travel = distance_factor * self.total_distance
    +    self.last_distance_reached = distance_to_travel
    +    for segment in self.segments:
    +        if distance_to_travel <= segment.distance:
    +            active_segment = segment
    +            if not segment.enter_event_triggered:
    +                segment.enter_event_triggered = True
    +                event_handler._handle_event(event_handler.Event.SEGMENT_ENTERED, segment.end)
    +            break
    +        distance_to_travel -= segment.distance
    +        if not segment.exit_event_triggered:
    +            segment.exit_event_triggered = True
    +            event_handler._handle_event(event_handler.Event.SEGMENT_EXITED, segment.end)
    +    else:  # if the distance_to_travel is further than the last waypoint, preserve the distance from the start of the final segment
    +        active_segment = self.segments[-1]
    +        distance_to_travel += active_segment.distance
    +    if active_segment.distance == 0:
    +        segment_distance_to_travel_factor = 0.0
    +    else:
    +        segment_distance_to_travel_factor = distance_to_travel / active_segment.distance
    +
    +    if active_segment.end.bezier_control:
    +        next_coord = geometry.find_coord_on_bezier_curve(
    +            active_segment.start.coord,
    +            active_segment.end.bezier_control,
    +            active_segment.end.coord,
    +            segment_distance_to_travel_factor,
    +        )
    +    else:
    +        next_coord = geometry.find_coord_on_line(
    +            active_segment.start.coord, active_segment.end.coord, segment_distance_to_travel_factor
    +        )
    +
    +    return next_coord
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/motion/segment/index.html b/engine/motion/segment/index.html new file mode 100755 index 00000000..2550bb06 --- /dev/null +++ b/engine/motion/segment/index.html @@ -0,0 +1,2104 @@ + + + + + + + + + + + + + + + + + + + + + + + Segment - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Segment

    +

    Module: terminaltexteffects.engine.motion

    + + +
    + + + + +
    + + +

    A segment of a path consisting of two waypoints and the distance between them.

    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    start + Waypoint + +
    +

    start waypoint

    +
    +
    end + Waypoint + +
    +

    end waypoint

    +
    +
    distance + float + +
    +

    distance between the start and end waypoints

    +
    +
    + + + +

    Methods:

    + + + + + + + + + + + + + +
    NameDescription
    get_coord_on_segment +
    +

    float) -> Coord: +Returns the coordinate at the given distance along the segment.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/motion.py +
    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
    @dataclass
    +class Segment:
    +    """A segment of a path consisting of two waypoints and the distance between them.
    +
    +    Attributes:
    +        start (Waypoint): start waypoint
    +        end (Waypoint): end waypoint
    +        distance (float): distance between the start and end waypoints
    +
    +    Methods:
    +        get_coord_on_segment(distance_factor: float) -> Coord:
    +            Returns the coordinate at the given distance along the segment.
    +    """
    +
    +    start: Waypoint
    +    end: Waypoint
    +    distance: float
    +
    +    def __post_init__(self) -> None:
    +        self.enter_event_triggered: bool = False
    +        self.exit_event_triggered: bool = False
    +
    +    def get_coord_on_segment(self, distance_factor: float) -> Coord:
    +        """Returns the coordinate at the given distance along the segment.
    +
    +        Args:
    +            distance_factor (float): distance factor
    +
    +        Returns:
    +            Coord: Coordinate at the given distance.
    +        """
    +        if self.start.bezier_control:
    +            return geometry.find_coord_on_bezier_curve(
    +                self.start.coord,
    +                self.start.bezier_control,
    +                self.end.coord,
    +                distance_factor,
    +            )
    +        else:
    +            return geometry.find_coord_on_line(self.start.coord, self.end.coord, distance_factor)
    +
    +    def __eq__(self, other: typing.Any) -> bool:
    +        if not isinstance(other, Segment):
    +            return NotImplemented
    +        return self.start == other.start and self.end == other.end
    +
    +    def __hash__(self):
    +        return hash((self.start, self.end))
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + get_coord_on_segment(distance_factor) + +

    + + +
    + +

    Returns the coordinate at the given distance along the segment.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    distance_factor + float + +
    +

    distance factor

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Coord + Coord + +
    +

    Coordinate at the given distance.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/motion.py +
    69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    def get_coord_on_segment(self, distance_factor: float) -> Coord:
    +    """Returns the coordinate at the given distance along the segment.
    +
    +    Args:
    +        distance_factor (float): distance factor
    +
    +    Returns:
    +        Coord: Coordinate at the given distance.
    +    """
    +    if self.start.bezier_control:
    +        return geometry.find_coord_on_bezier_curve(
    +            self.start.coord,
    +            self.start.bezier_control,
    +            self.end.coord,
    +            distance_factor,
    +        )
    +    else:
    +        return geometry.find_coord_on_line(self.start.coord, self.end.coord, distance_factor)
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/motion/waypoint/index.html b/engine/motion/waypoint/index.html new file mode 100755 index 00000000..365715fd --- /dev/null +++ b/engine/motion/waypoint/index.html @@ -0,0 +1,1915 @@ + + + + + + + + + + + + + + + + + + + + + + + Waypoint - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Waypoint

    +

    Module: terminaltexteffects.engine.motion

    + + +
    + + + + +
    + + +

    A Waypoint comprises a coordinate, speed, and, optionally, bezier control point(s).

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    waypoint_id + str + +
    +

    unique identifier for the waypoint

    +
    +
    + required +
    coord + Coord + +
    +

    coordinate

    +
    +
    + required +
    bezier_control + tuple[Coord, ...] | Coord | None + +
    +

    coordinate of the control point for a bezier curve. Defaults to None.

    +
    +
    + None +
    + +
    + Source code in terminaltexteffects/engine/motion.py +
    20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    @dataclass
    +class Waypoint:
    +    """A Waypoint comprises a coordinate, speed, and, optionally, bezier control point(s).
    +
    +    Args:
    +        waypoint_id (str): unique identifier for the waypoint
    +        coord (Coord): coordinate
    +        bezier_control (tuple[Coord, ...] | Coord | None): coordinate of the control point for a bezier curve. Defaults to None.
    +    """
    +
    +    waypoint_id: str
    +    coord: Coord
    +    bezier_control: tuple[Coord, ...] | Coord | None = None
    +
    +    def __post_init__(self) -> None:
    +        if self.bezier_control and isinstance(self.bezier_control, Coord):
    +            self.bezier_control = (self.bezier_control,)
    +
    +    def __eq__(self, other: typing.Any) -> bool:
    +        if not isinstance(other, Waypoint):
    +            return NotImplemented
    +        return self.coord == other.coord
    +
    +    def __hash__(self):
    +        return hash(self.waypoint_id)
    +
    +
    + + + +
    + + + + + + + + + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/terminal/outputarea/index.html b/engine/terminal/outputarea/index.html new file mode 100755 index 00000000..4b0b9526 --- /dev/null +++ b/engine/terminal/outputarea/index.html @@ -0,0 +1,2524 @@ + + + + + + + + + + + + + + + + + + + + + + + OutputArea - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    OutputArea

    +

    Module: terminaltexteffects.engine.terminal

    + + +
    + + + + +
    + + +

    Represents the output area in the terminal. The output area is the area defined +by the dimensions of the input data, unless specified otherwise in the TerminalConfig.

    +

    This class provides methods for working with the output area, such as checking if a coordinate is within the output area, +getting random coordinates within the output area, and getting a random coordinate outside the output area.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    top + int + +
    +

    top row of the output area

    +
    +
    + required +
    right + int + +
    +

    right column of the output area

    +
    +
    + required +
    bottom + int + +
    +

    bottom row of the output area. Defaults to 1.

    +
    +
    + 1 +
    left + int + +
    +

    left column of the output area. Defaults to 1.

    +
    +
    + 1 +
    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    center_row + int + +
    +

    row of the center of the output area

    +
    +
    center_column + int + +
    +

    column of the center of the output area

    +
    +
    center + Coord + +
    +

    coordinate of the center of the output area

    +
    +
    + + + +

    Methods:

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameDescription
    coord_is_in_output_area +
    +

    Coord) -> bool: Checks whether a coordinate is within the output area.

    +
    +
    random_column +
    +

    Get a random column position within the output area.

    +
    +
    random_row +
    +

    Get a random row position within the output area.

    +
    +
    random_coord +
    +

    Get a random coordinate within or outside the output area.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    @dataclass
    +class OutputArea:
    +    """Represents the output area in the terminal. The output area is the area defined
    +    by the dimensions of the input data, unless specified otherwise in the TerminalConfig.
    +
    +    This class provides methods for working with the output area, such as checking if a coordinate is within the output area,
    +    getting random coordinates within the output area, and getting a random coordinate outside the output area.
    +
    +    Args:
    +        top (int): top row of the output area
    +        right (int): right column of the output area
    +        bottom (int): bottom row of the output area. Defaults to 1.
    +        left (int): left column of the output area. Defaults to 1.
    +
    +    Attributes:
    +        center_row (int): row of the center of the output area
    +        center_column (int): column of the center of the output area
    +        center (Coord): coordinate of the center of the output area
    +
    +    Methods:
    +        coord_is_in_output_area(coord: Coord) -> bool: Checks whether a coordinate is within the output area.
    +        random_column() -> int: Get a random column position within the output area.
    +        random_row() -> int: Get a random row position within the output area.
    +        random_coord(outside_scope=False) -> Coord: Get a random coordinate within or outside the output area.
    +
    +    """
    +
    +    top: int
    +    right: int
    +    bottom: int = 1
    +    left: int = 1
    +
    +    def __post_init__(self):
    +        self.center_row = max(self.top // 2, 1)
    +        self.center_column = max(self.right // 2, 1)
    +        self.center = Coord(self.center_column, self.center_row)
    +
    +    def coord_is_in_output_area(self, coord: Coord) -> bool:
    +        """Checks whether a coordinate is within the output area.
    +
    +        Args:
    +            coord (Coord): coordinate to check
    +
    +        Returns:
    +            bool: whether the coordinate is within the output area
    +        """
    +        return self.left <= coord.column <= self.right and self.bottom <= coord.row <= self.top
    +
    +    def random_column(self) -> int:
    +        """Get a random column position. Position is within the output area.
    +
    +        Returns:
    +            int: a random column position (1 <= x <= output_area.right)"""
    +        return random.randint(1, self.right)
    +
    +    def random_row(self) -> int:
    +        """Get a random row position. Position is within the output area.
    +
    +        Returns:
    +            int: a random row position (1 <= x <= terminal.output_area.top)"""
    +        return random.randint(1, self.top)
    +
    +    def random_coord(self, outside_scope=False) -> Coord:
    +        """Get a random coordinate. Coordinate is within the output area unless outside_scope is True.
    +
    +        Args:
    +            outside_scope (bool, optional): whether the coordinate should fall outside the output area. Defaults to False.
    +
    +        Returns:
    +            Coord: a random coordinate . Coordinate is within the output area unless outside_scope is True."""
    +        if outside_scope is True:
    +            random_coord_above = Coord(self.random_column(), self.top + 1)
    +            random_coord_below = Coord(self.random_column(), -1)
    +            random_coord_left = Coord(-1, self.random_row())
    +            random_coord_right = Coord(self.right + 1, self.random_row())
    +            return random.choice([random_coord_above, random_coord_below, random_coord_left, random_coord_right])
    +        else:
    +            return Coord(self.random_column(), self.random_row())
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + coord_is_in_output_area(coord) + +

    + + +
    + +

    Checks whether a coordinate is within the output area.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    coord + Coord + +
    +

    coordinate to check

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    bool + bool + +
    +

    whether the coordinate is within the output area

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def coord_is_in_output_area(self, coord: Coord) -> bool:
    +    """Checks whether a coordinate is within the output area.
    +
    +    Args:
    +        coord (Coord): coordinate to check
    +
    +    Returns:
    +        bool: whether the coordinate is within the output area
    +    """
    +    return self.left <= coord.column <= self.right and self.bottom <= coord.row <= self.top
    +
    +
    +
    + +
    + + +
    + + + +

    + random_column() + +

    + + +
    + +

    Get a random column position. Position is within the output area.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    int + int + +
    +

    a random column position (1 <= x <= output_area.right)

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def random_column(self) -> int:
    +    """Get a random column position. Position is within the output area.
    +
    +    Returns:
    +        int: a random column position (1 <= x <= output_area.right)"""
    +    return random.randint(1, self.right)
    +
    +
    +
    + +
    + + +
    + + + +

    + random_coord(outside_scope=False) + +

    + + +
    + +

    Get a random coordinate. Coordinate is within the output area unless outside_scope is True.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    outside_scope + bool + +
    +

    whether the coordinate should fall outside the output area. Defaults to False.

    +
    +
    + False +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Coord + Coord + +
    +

    a random coordinate . Coordinate is within the output area unless outside_scope is True.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def random_coord(self, outside_scope=False) -> Coord:
    +    """Get a random coordinate. Coordinate is within the output area unless outside_scope is True.
    +
    +    Args:
    +        outside_scope (bool, optional): whether the coordinate should fall outside the output area. Defaults to False.
    +
    +    Returns:
    +        Coord: a random coordinate . Coordinate is within the output area unless outside_scope is True."""
    +    if outside_scope is True:
    +        random_coord_above = Coord(self.random_column(), self.top + 1)
    +        random_coord_below = Coord(self.random_column(), -1)
    +        random_coord_left = Coord(-1, self.random_row())
    +        random_coord_right = Coord(self.right + 1, self.random_row())
    +        return random.choice([random_coord_above, random_coord_below, random_coord_left, random_coord_right])
    +    else:
    +        return Coord(self.random_column(), self.random_row())
    +
    +
    +
    + +
    + + +
    + + + +

    + random_row() + +

    + + +
    + +

    Get a random row position. Position is within the output area.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    int + int + +
    +

    a random row position (1 <= x <= terminal.output_area.top)

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def random_row(self) -> int:
    +    """Get a random row position. Position is within the output area.
    +
    +    Returns:
    +        int: a random row position (1 <= x <= terminal.output_area.top)"""
    +    return random.randint(1, self.top)
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/terminal/terminal/index.html b/engine/terminal/terminal/index.html new file mode 100755 index 00000000..525449dc --- /dev/null +++ b/engine/terminal/terminal/index.html @@ -0,0 +1,4844 @@ + + + + + + + + + + + + + + + + + + + + + + + Terminal - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + + + + + +
    +
    + + + + +

    Terminal

    +

    Module: terminaltexteffects.engine.terminal

    + + +
    + + + + +
    + + +

    A class for managing the terminal state and output.

    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    config + TerminalConfig + +
    +

    Configuration for the terminal.

    +
    +
    output_area + OutputArea + +
    +

    The output area in the terminal.

    +
    +
    character_by_input_coord + dict[Coord, EffectCharacter] + +
    +

    A dictionary of characters by their input coordinates.

    +
    +
    + + + +

    Methods:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameDescription
    get_piped_input +
    +

    Gets the piped input from stdin.

    +
    +
    prep_outputarea +
    +

    Prepares the terminal for the effect by adding empty lines and hiding the cursor.

    +
    +
    restore_cursor +
    +

    Restores the cursor visibility.

    +
    +
    get_characters +
    +

    bool = True, fill_chars: bool = False, added_chars: bool = False, sort: CharacterSort = CharacterSort.TOP_TO_BOTTOM_LEFT_TO_RIGHT) -> list[EffectCharacter]: Get a list of all EffectCharacters in the terminal with an optional sort.

    +
    +
    get_characters_grouped +
    +

    CharacterGroup = CharacterGroup.ROW_TOP_TO_BOTTOM, input_characters: bool = True, fill_chars: bool = False, added_chars: bool = False) -> list[list[EffectCharacter]]: Get a list of all EffectCharacters grouped by the specified CharacterGroup grouping.

    +
    +
    get_character_by_input_coord +
    +

    Coord) -> EffectCharacter | None: Get an EffectCharacter by its input coordinates.

    +
    +
    set_character_visibility +
    +

    EffectCharacter, is_visible: bool): Set the visibility of a character.

    +
    +
    get_formatted_output_string +
    +

    Get the formatted output string based on the current terminal state.

    +
    +
    print +
    +

    str, enforce_frame_rate: bool = True): Prints the current terminal state to stdout while preserving the cursor position.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    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
    +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
    +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
    +509
    +510
    +511
    +512
    +513
    +514
    +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
    class Terminal:
    +    """A class for managing the terminal state and output.
    +
    +    Attributes:
    +        config (TerminalConfig): Configuration for the terminal.
    +        output_area (OutputArea): The output area in the terminal.
    +        character_by_input_coord (dict[Coord, EffectCharacter]): A dictionary of characters by their input coordinates.
    +
    +    Methods:
    +        get_piped_input() -> str: Gets the piped input from stdin.
    +        prep_outputarea(): Prepares the terminal for the effect by adding empty lines and hiding the cursor.
    +        restore_cursor(): Restores the cursor visibility.
    +        get_characters(input_characters: bool = True, fill_chars: bool = False, added_chars: bool = False, sort: CharacterSort = CharacterSort.TOP_TO_BOTTOM_LEFT_TO_RIGHT) -> list[EffectCharacter]: Get a list of all EffectCharacters in the terminal with an optional sort.
    +        get_characters_grouped(grouping: CharacterGroup = CharacterGroup.ROW_TOP_TO_BOTTOM, input_characters: bool = True, fill_chars: bool = False, added_chars: bool = False) -> list[list[EffectCharacter]]: Get a list of all EffectCharacters grouped by the specified CharacterGroup grouping.
    +        get_character_by_input_coord(coord: Coord) -> EffectCharacter | None: Get an EffectCharacter by its input coordinates.
    +        set_character_visibility(character: EffectCharacter, is_visible: bool): Set the visibility of a character.
    +        get_formatted_output_string() -> str: Get the formatted output string based on the current terminal state.
    +        print(output_string: str, enforce_frame_rate: bool = True): Prints the current terminal state to stdout while preserving the cursor position.
    +
    +    """
    +
    +    class CharacterGroup(Enum):
    +        """An enum specifying character groupings.
    +
    +        Attributes:
    +            COLUMN_LEFT_TO_RIGHT: Group characters by column from left to right.
    +            COLUMN_RIGHT_TO_LEFT: Group characters by column from right to left.
    +            ROW_TOP_TO_BOTTOM: Group characters by row from top to bottom.
    +            ROW_BOTTOM_TO_TOP: Group characters by row from bottom to top.
    +            DIAGONAL_TOP_LEFT_TO_BOTTOM_RIGHT: Group characters by diagonal from top left to bottom right.
    +            DIAGONAL_BOTTOM_LEFT_TO_TOP_RIGHT: Group characters by diagonal from bottom left to top right.
    +            DIAGONAL_TOP_RIGHT_TO_BOTTOM_LEFT: Group characters by diagonal from top right to bottom left.
    +            DIAGONAL_BOTTOM_RIGHT_TO_TOP_LEFT: Group characters by diagonal from bottom right to top left.
    +            CENTER_TO_OUTSIDE_DIAMONDS: Group characters by distance from the center to the outside in diamond shapes.
    +            OUTSIDE_TO_CENTER_DIAMONDS: Group characters by distance from the outside to the center in diamond shapes.
    +        """
    +
    +        COLUMN_LEFT_TO_RIGHT = auto()
    +        COLUMN_RIGHT_TO_LEFT = auto()
    +        ROW_TOP_TO_BOTTOM = auto()
    +        ROW_BOTTOM_TO_TOP = auto()
    +        DIAGONAL_TOP_LEFT_TO_BOTTOM_RIGHT = auto()
    +        DIAGONAL_BOTTOM_LEFT_TO_TOP_RIGHT = auto()
    +        DIAGONAL_TOP_RIGHT_TO_BOTTOM_LEFT = auto()
    +        DIAGONAL_BOTTOM_RIGHT_TO_TOP_LEFT = auto()
    +        CENTER_TO_OUTSIDE_DIAMONDS = auto()
    +        OUTSIDE_TO_CENTER_DIAMONDS = auto()
    +
    +    class CharacterSort(Enum):
    +        """An enum for specifying character sorts.
    +
    +        Attributes:
    +            RANDOM: Random order.
    +            TOP_TO_BOTTOM_LEFT_TO_RIGHT: Top to bottom, left to right.
    +            TOP_TO_BOTTOM_RIGHT_TO_LEFT: Top to bottom, right to left.
    +            BOTTOM_TO_TOP_LEFT_TO_RIGHT: Bottom to top, left to right.
    +            BOTTOM_TO_TOP_RIGHT_TO_LEFT: Bottom to top, right to left.
    +            OUTSIDE_ROW_TO_MIDDLE: Outside row to middle.
    +            MIDDLE_ROW_TO_OUTSIDE: Middle row to outside.
    +        """
    +
    +        RANDOM = auto()
    +        TOP_TO_BOTTOM_LEFT_TO_RIGHT = auto()
    +        TOP_TO_BOTTOM_RIGHT_TO_LEFT = auto()
    +        BOTTOM_TO_TOP_LEFT_TO_RIGHT = auto()
    +        BOTTOM_TO_TOP_RIGHT_TO_LEFT = auto()
    +        OUTSIDE_ROW_TO_MIDDLE = auto()
    +        MIDDLE_ROW_TO_OUTSIDE = auto()
    +
    +    def __init__(self, input_data: str, config: TerminalConfig | None = None):
    +        """Initializes the Terminal object.
    +
    +        Args:
    +            input_data (str): The input data to be displayed in the terminal.
    +            config (TerminalConfig, optional): Configuration for the terminal. Defaults to None.
    +        """
    +        if config is None:
    +            self.config = TerminalConfig()
    +        else:
    +            self.config = config
    +        if not input_data:
    +            input_data = "No Input."
    +        self._input_data = input_data.replace("\t", " " * self.config.tab_width)
    +        if self.config.ignore_terminal_dimensions:
    +            self._width = max([len(line) for line in self._input_data.splitlines()])
    +            self._height = len(self._input_data.splitlines()) + 1
    +        elif self.config.terminal_dimensions == (0, 0):
    +            self._width, self._height = self._get_terminal_dimensions()
    +        else:
    +            self._width, self._height = self.config.terminal_dimensions
    +        self._next_character_id = 0
    +        self._input_characters = self._decompose_input(self.config.xterm_colors, self.config.no_color)
    +        self._added_characters: list[EffectCharacter] = []
    +        self._input_width = max([character.input_coord.column for character in self._input_characters])
    +        self._input_height = max([character.input_coord.row for character in self._input_characters])
    +        self.output_area = OutputArea(min(self._height - 1, self._input_height), self._input_width)
    +        self._input_characters = [
    +            character
    +            for character in self._input_characters
    +            if character.input_coord.row <= self.output_area.top
    +            and character.input_coord.column <= self.output_area.right
    +        ]
    +        self.character_by_input_coord: dict[Coord, EffectCharacter] = {
    +            (character.input_coord): character for character in self._input_characters
    +        }
    +        self._fill_characters = self._make_fill_characters()
    +        self._visible_characters: set[EffectCharacter] = set()
    +        self._frame_rate = self.config.frame_rate
    +        self._last_time_printed = time.time()
    +        self._update_terminal_state()
    +
    +    def _get_terminal_dimensions(self) -> tuple[int, int]:
    +        """Gets the terminal dimensions.
    +
    +        Returns:
    +            tuple[int, int]: terminal width and height
    +        """
    +        try:
    +            terminal_width, terminal_height = shutil.get_terminal_size()
    +        except OSError:
    +            # If the terminal size cannot be determined, return default values
    +            return 80, 24
    +        return terminal_width, terminal_height
    +
    +    @staticmethod
    +    def get_piped_input() -> str:
    +        """Gets the piped input from stdin.
    +
    +        This method checks if there is any piped input from the standard input (stdin).
    +        If there is no piped input, it returns an empty string.
    +        If there is piped input, it reads the input data from stdin and returns it as a string.
    +
    +        The `sys.stdin.isatty()` check is used to determine if the program is being run interactively
    +        or if there is piped input. When the program is run interactively, `sys.stdin.isatty()` returns True,
    +        indicating that there is no piped input. In this case, the method returns an empty string.
    +
    +        Returns:
    +            str: The piped input from stdin as a string, or an empty string if there is no piped input.
    +        """
    +        if sys.stdin.isatty():
    +            return ""
    +        return sys.stdin.read()
    +
    +    def _wrap_lines(self, lines: list[str]) -> list[str]:
    +        """
    +        Wraps the given lines of text to fit within the width of the terminal.
    +
    +        Args:
    +            lines (list): The lines of text to be wrapped.
    +
    +        Returns:
    +            list: The wrapped lines of text.
    +        """
    +        wrapped_lines = []
    +        for line in lines:
    +            while len(line) > self._width:
    +                wrapped_lines.append(line[: self._width])
    +                line = line[self._width :]
    +            wrapped_lines.append(line)
    +        return wrapped_lines
    +
    +    def _decompose_input(self, use_xterm_colors: bool, no_color: bool) -> list[EffectCharacter]:
    +        """Decomposes the output into a list of Character objects containing the symbol and its row/column coordinates
    +        relative to the input display location.
    +
    +        Coordinates are relative to the cursor row position at the time of execution. 1,1 is the bottom left corner of the row
    +        above the cursor.
    +
    +        Args:
    +            use_xterm_colors (bool): whether to convert colors to the closest XTerm-256 color
    +
    +        Returns:
    +            list[Character]: list of EffectCharacter objects
    +        """
    +        formatted_lines = []
    +        if not self._input_data.strip():
    +            self._input_data = "No Input."
    +        lines = self._input_data.splitlines()
    +        formatted_lines = self._wrap_lines(lines) if self.config.wrap_text else [line[: self._width] for line in lines]
    +        input_height = len(formatted_lines)
    +        input_characters = []
    +        for row, line in enumerate(formatted_lines):
    +            for column, symbol in enumerate(line):
    +                if symbol != " ":
    +                    character = EffectCharacter(self._next_character_id, symbol, column + 1, input_height - row)
    +                    character.animation.use_xterm_colors = use_xterm_colors
    +                    character.animation.no_color = no_color
    +                    input_characters.append(character)
    +                    self._next_character_id += 1
    +        return input_characters
    +
    +    def _make_fill_characters(self) -> list[EffectCharacter]:
    +        """Creates a list of characters to fill the empty spaces in the output area. The characters input_symbol is a space.
    +        The fill characters are added to the character_by_input_coord dictionary.
    +
    +        Returns:
    +            list[EffectCharacter]: list of characters
    +        """
    +        fill_characters = []
    +        for row in range(1, self.output_area.top + 1):
    +            for column in range(1, self.output_area.right + 1):
    +                coord = Coord(column, row)
    +                if coord not in self.character_by_input_coord:
    +                    fill_char = EffectCharacter(self._next_character_id, " ", column, row)
    +                    fill_characters.append(fill_char)
    +                    self.character_by_input_coord[coord] = fill_char
    +                    self._next_character_id += 1
    +        return fill_characters
    +
    +    def add_character(self, symbol: str, coord: Coord) -> EffectCharacter:
    +        """Adds a character to the terminal for printing. Used to create characters that are not in the input data.
    +
    +        Args:
    +            symbol (str): symbol to add
    +            coord: (Coord): set character's input coordinates
    +
    +        Returns:
    +            EffectCharacter: the character that was added
    +        """
    +        character = EffectCharacter(self._next_character_id, symbol, coord.column, coord.row)
    +        character.animation.use_xterm_colors = self.config.xterm_colors
    +        character.animation.no_color = self.config.no_color
    +        self._added_characters.append(character)
    +        self._next_character_id += 1
    +        return character
    +
    +    def _update_terminal_state(self):
    +        """Update the internal representation of the terminal state with the current position
    +        of all visible characters.
    +        """
    +        rows = [[" " for _ in range(self.output_area.right)] for _ in range(self.output_area.top)]
    +        for character in sorted(self._visible_characters, key=lambda c: c.layer):
    +            row = character.motion.current_coord.row - 1
    +            column = character.motion.current_coord.column - 1
    +            if 0 <= row < self.output_area.top and 0 <= column < self.output_area.right:
    +                rows[row][column] = character.symbol
    +        terminal_state = ["".join(row) for row in rows]
    +        self.terminal_state = terminal_state
    +
    +    def prep_outputarea(self) -> None:
    +        """Prepares the terminal for the effect by adding empty lines and hiding the cursor."""
    +        sys.stdout.write(ansitools.HIDE_CURSOR())
    +        print("\n" * self.output_area.top)
    +
    +    def restore_cursor(self) -> None:
    +        """Restores the cursor visibility."""
    +        sys.stdout.write(ansitools.SHOW_CURSOR())
    +
    +    def get_characters(
    +        self,
    +        *,
    +        input_characters: bool = True,
    +        fill_chars: bool = False,
    +        added_chars: bool = False,
    +        sort: CharacterSort = CharacterSort.TOP_TO_BOTTOM_LEFT_TO_RIGHT,
    +    ) -> list[EffectCharacter]:
    +        """Get a list of all EffectCharacters in the terminal with an optional sort.
    +
    +        Args:
    +            input_characters (bool, optional): whether to include input characters. Defaults to True.
    +            fill_chars (bool, optional): whether to include fill characters. Defaults to False.
    +            added_chars (bool, optional): whether to include added characters. Defaults to False.
    +            sort (CharacterSort, optional): order to sort the characters. Defaults to CharacterSort.TOP_TO_BOTTOM_LEFT_TO_RIGHT.
    +
    +        Returns:
    +            list[EffectCharacter]: list of EffectCharacters in the terminal
    +        """
    +        all_characters: list[EffectCharacter] = []
    +        if input_characters:
    +            all_characters.extend(self._input_characters)
    +        if fill_chars:
    +            all_characters.extend(self._fill_characters)
    +        if added_chars:
    +            all_characters.extend(self._added_characters)
    +
    +        # default sort TOP_TO_BOTTOM_LEFT_TO_RIGHT
    +        all_characters.sort(key=lambda character: (-character.input_coord.row, character.input_coord.column))
    +
    +        if sort is self.CharacterSort.RANDOM:
    +            random.shuffle(all_characters)
    +
    +        elif sort in (self.CharacterSort.TOP_TO_BOTTOM_LEFT_TO_RIGHT, self.CharacterSort.BOTTOM_TO_TOP_RIGHT_TO_LEFT):
    +            if sort is self.CharacterSort.BOTTOM_TO_TOP_RIGHT_TO_LEFT:
    +                all_characters.reverse()
    +
    +        elif sort in (self.CharacterSort.BOTTOM_TO_TOP_LEFT_TO_RIGHT, self.CharacterSort.TOP_TO_BOTTOM_RIGHT_TO_LEFT):
    +            all_characters.sort(key=lambda character: (character.input_coord.row, character.input_coord.column))
    +            if sort is self.CharacterSort.TOP_TO_BOTTOM_RIGHT_TO_LEFT:
    +                all_characters.reverse()
    +
    +        elif sort in (self.CharacterSort.OUTSIDE_ROW_TO_MIDDLE, self.CharacterSort.MIDDLE_ROW_TO_OUTSIDE):
    +            all_characters = [
    +                all_characters.pop(0) if i % 2 == 0 else all_characters.pop(-1) for i in range(len(all_characters))
    +            ]
    +            if sort is self.CharacterSort.MIDDLE_ROW_TO_OUTSIDE:
    +                all_characters.reverse()
    +
    +        return all_characters
    +
    +    def get_characters_grouped(
    +        self,
    +        grouping: CharacterGroup = CharacterGroup.ROW_TOP_TO_BOTTOM,
    +        *,
    +        input_characters: bool = True,
    +        fill_chars: bool = False,
    +        added_chars: bool = False,
    +    ) -> list[list[EffectCharacter]]:
    +        """Get a list of all EffectCharacters grouped by the specified CharacterGroup grouping.
    +
    +        Args:
    +            grouping (CharacterGroup, optional): order to group the characters. Defaults to ROW_TOP_TO_BOTTOM.
    +            input_characters (bool, optional): whether to include input characters. Defaults to True.
    +            fill_chars (bool, optional): whether to include fill characters. Defaults to False.
    +            added_chars (bool, optional): whether to include added characters. Defaults to False.
    +
    +        Returns:
    +            list[list[EffectCharacter]]: list of lists of EffectCharacters in the terminal. Inner lists correspond to groups as specified in the grouping.
    +        """
    +        all_characters: list[EffectCharacter] = []
    +        if input_characters:
    +            all_characters.extend(self._input_characters)
    +        if fill_chars:
    +            all_characters.extend(self._fill_characters)
    +        if added_chars:
    +            all_characters.extend(self._added_characters)
    +
    +        all_characters.sort(key=lambda character: (character.input_coord.row, character.input_coord.column))
    +
    +        if grouping in (self.CharacterGroup.COLUMN_LEFT_TO_RIGHT, self.CharacterGroup.COLUMN_RIGHT_TO_LEFT):
    +            columns = []
    +            for column_index in range(self.output_area.right + 1):
    +                characters_in_column = [
    +                    character for character in all_characters if character.input_coord.column == column_index
    +                ]
    +                if characters_in_column:
    +                    columns.append(characters_in_column)
    +            if grouping == self.CharacterGroup.COLUMN_RIGHT_TO_LEFT:
    +                columns.reverse()
    +            return columns
    +
    +        elif grouping in (self.CharacterGroup.ROW_BOTTOM_TO_TOP, self.CharacterGroup.ROW_TOP_TO_BOTTOM):
    +            rows = []
    +            for row_index in range(self.output_area.top + 1):
    +                characters_in_row = [
    +                    character for character in all_characters if character.input_coord.row == row_index
    +                ]
    +                if characters_in_row:
    +                    rows.append(characters_in_row)
    +            if grouping == self.CharacterGroup.ROW_TOP_TO_BOTTOM:
    +                rows.reverse()
    +            return rows
    +        elif grouping in (
    +            self.CharacterGroup.DIAGONAL_BOTTOM_LEFT_TO_TOP_RIGHT,
    +            self.CharacterGroup.DIAGONAL_TOP_RIGHT_TO_BOTTOM_LEFT,
    +        ):
    +            diagonals = []
    +            for diagonal_index in range(self.output_area.top + self.output_area.right + 1):
    +                characters_in_diagonal = [
    +                    character
    +                    for character in all_characters
    +                    if character.input_coord.row + character.input_coord.column == diagonal_index
    +                ]
    +                if characters_in_diagonal:
    +                    diagonals.append(characters_in_diagonal)
    +            if grouping == self.CharacterGroup.DIAGONAL_TOP_RIGHT_TO_BOTTOM_LEFT:
    +                diagonals.reverse()
    +            return diagonals
    +        elif grouping in (
    +            self.CharacterGroup.DIAGONAL_TOP_LEFT_TO_BOTTOM_RIGHT,
    +            self.CharacterGroup.DIAGONAL_BOTTOM_RIGHT_TO_TOP_LEFT,
    +        ):
    +            diagonals = []
    +            for diagonal_index in range(
    +                self.output_area.left - self.output_area.top, self.output_area.right - self.output_area.bottom + 1
    +            ):
    +                characters_in_diagonal = [
    +                    character
    +                    for character in all_characters
    +                    if character.input_coord.column - character.input_coord.row == diagonal_index
    +                ]
    +                if characters_in_diagonal:
    +                    diagonals.append(characters_in_diagonal)
    +            if grouping == self.CharacterGroup.DIAGONAL_BOTTOM_RIGHT_TO_TOP_LEFT:
    +                diagonals.reverse()
    +            return diagonals
    +        elif grouping in (
    +            self.CharacterGroup.CENTER_TO_OUTSIDE_DIAMONDS,
    +            self.CharacterGroup.OUTSIDE_TO_CENTER_DIAMONDS,
    +        ):
    +            distance_map: dict[int, list[EffectCharacter]] = {}
    +            center_out = []
    +            for character in all_characters:
    +                distance = abs(character.input_coord.column - self.output_area.center.column) + abs(
    +                    character.input_coord.row - self.output_area.center.row
    +                )
    +                if distance not in distance_map:
    +                    distance_map[distance] = []
    +                distance_map[distance].append(character)
    +            for distance in sorted(
    +                distance_map.keys(), reverse=grouping is self.CharacterGroup.OUTSIDE_TO_CENTER_DIAMONDS
    +            ):
    +                center_out.append(distance_map[distance])
    +            return center_out
    +
    +        else:
    +            raise ValueError(f"Invalid sort_order: {grouping}")
    +
    +    def get_character_by_input_coord(self, coord: Coord) -> EffectCharacter | None:
    +        """Get an EffectCharacter by its input coordinates.
    +
    +        Args:
    +            coord (Coord): input coordinates of the character
    +
    +        Returns:
    +            EffectCharacter | None: the character at the specified coordinates, or None if no character is found
    +        """
    +        if coord not in self.character_by_input_coord:
    +            return None
    +        return self.character_by_input_coord[coord]
    +
    +    def set_character_visibility(self, character: EffectCharacter, is_visible: bool) -> None:
    +        """Set the visibility of a character.
    +
    +        Args:
    +            character (EffectCharacter): the character to set visibility for
    +            is_visible (bool): whether the character should be visible
    +        """
    +        character._is_visible = is_visible
    +        if is_visible:
    +            self._visible_characters.add(character)
    +        else:
    +            self._visible_characters.discard(character)
    +
    +    def get_formatted_output_string(self) -> str:
    +        """Get the formatted output string based on the current terminal state.
    +
    +        This method updates the internal terminal representation state before returning the formatted output string.
    +
    +        Returns:
    +            str: The formatted output string.
    +        """
    +        self._update_terminal_state()
    +        output_string = "\n".join(self.terminal_state[::-1])
    +        return output_string
    +
    +    def print(self, output_string: str, *, enforce_frame_rate: bool = True):
    +        """Prints the current terminal state to stdout while preserving the cursor position.
    +
    +        Args:
    +            output_string (str): The string to be printed.
    +            enforce_frame_rate (bool, optional): Whether to enforce the frame rate set in the terminal config. Defaults to True.
    +
    +        Notes:
    +            This method includes animation timing to control the frame rate.
    +            If the time since the last print is less than required to limit the frame rate, the method will sleep for the remaining time
    +            to ensure a consistent animation speed.
    +
    +        """
    +        if enforce_frame_rate:
    +            frame_delay = 1 / self._frame_rate
    +            time_since_last_print = time.time() - self._last_time_printed
    +            if time_since_last_print < frame_delay:
    +                time.sleep(frame_delay - time_since_last_print)
    +        sys.stdout.write(ansitools.DEC_SAVE_CURSOR_POSITION())
    +        sys.stdout.write(ansitools.MOVE_CURSOR_UP(self.output_area.top))
    +        sys.stdout.write(ansitools.MOVE_CURSOR_TO_COLUMN(1))
    +        sys.stdout.write(output_string)
    +        sys.stdout.write(ansitools.DEC_RESTORE_CURSOR_POSITION())
    +        sys.stdout.flush()
    +        self._last_time_printed = time.time()
    +
    +
    + + + +
    + + + + + + + + +
    + + + +

    + CharacterGroup + + +

    + + +
    +

    + Bases: Enum

    + + +

    An enum specifying character groupings.

    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    COLUMN_LEFT_TO_RIGHT + +
    +

    Group characters by column from left to right.

    +
    +
    COLUMN_RIGHT_TO_LEFT + +
    +

    Group characters by column from right to left.

    +
    +
    ROW_TOP_TO_BOTTOM + +
    +

    Group characters by row from top to bottom.

    +
    +
    ROW_BOTTOM_TO_TOP + +
    +

    Group characters by row from bottom to top.

    +
    +
    DIAGONAL_TOP_LEFT_TO_BOTTOM_RIGHT + +
    +

    Group characters by diagonal from top left to bottom right.

    +
    +
    DIAGONAL_BOTTOM_LEFT_TO_TOP_RIGHT + +
    +

    Group characters by diagonal from bottom left to top right.

    +
    +
    DIAGONAL_TOP_RIGHT_TO_BOTTOM_LEFT + +
    +

    Group characters by diagonal from top right to bottom left.

    +
    +
    DIAGONAL_BOTTOM_RIGHT_TO_TOP_LEFT + +
    +

    Group characters by diagonal from bottom right to top left.

    +
    +
    CENTER_TO_OUTSIDE_DIAMONDS + +
    +

    Group characters by distance from the center to the outside in diamond shapes.

    +
    +
    OUTSIDE_TO_CENTER_DIAMONDS + +
    +

    Group characters by distance from the outside to the center in diamond shapes.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    class CharacterGroup(Enum):
    +    """An enum specifying character groupings.
    +
    +    Attributes:
    +        COLUMN_LEFT_TO_RIGHT: Group characters by column from left to right.
    +        COLUMN_RIGHT_TO_LEFT: Group characters by column from right to left.
    +        ROW_TOP_TO_BOTTOM: Group characters by row from top to bottom.
    +        ROW_BOTTOM_TO_TOP: Group characters by row from bottom to top.
    +        DIAGONAL_TOP_LEFT_TO_BOTTOM_RIGHT: Group characters by diagonal from top left to bottom right.
    +        DIAGONAL_BOTTOM_LEFT_TO_TOP_RIGHT: Group characters by diagonal from bottom left to top right.
    +        DIAGONAL_TOP_RIGHT_TO_BOTTOM_LEFT: Group characters by diagonal from top right to bottom left.
    +        DIAGONAL_BOTTOM_RIGHT_TO_TOP_LEFT: Group characters by diagonal from bottom right to top left.
    +        CENTER_TO_OUTSIDE_DIAMONDS: Group characters by distance from the center to the outside in diamond shapes.
    +        OUTSIDE_TO_CENTER_DIAMONDS: Group characters by distance from the outside to the center in diamond shapes.
    +    """
    +
    +    COLUMN_LEFT_TO_RIGHT = auto()
    +    COLUMN_RIGHT_TO_LEFT = auto()
    +    ROW_TOP_TO_BOTTOM = auto()
    +    ROW_BOTTOM_TO_TOP = auto()
    +    DIAGONAL_TOP_LEFT_TO_BOTTOM_RIGHT = auto()
    +    DIAGONAL_BOTTOM_LEFT_TO_TOP_RIGHT = auto()
    +    DIAGONAL_TOP_RIGHT_TO_BOTTOM_LEFT = auto()
    +    DIAGONAL_BOTTOM_RIGHT_TO_TOP_LEFT = auto()
    +    CENTER_TO_OUTSIDE_DIAMONDS = auto()
    +    OUTSIDE_TO_CENTER_DIAMONDS = auto()
    +
    +
    + + + +
    + + + + + + + + + + + +
    + +
    + + +
    + +
    + + + +

    + CharacterSort + + +

    + + +
    +

    + Bases: Enum

    + + +

    An enum for specifying character sorts.

    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    RANDOM + +
    +

    Random order.

    +
    +
    TOP_TO_BOTTOM_LEFT_TO_RIGHT + +
    +

    Top to bottom, left to right.

    +
    +
    TOP_TO_BOTTOM_RIGHT_TO_LEFT + +
    +

    Top to bottom, right to left.

    +
    +
    BOTTOM_TO_TOP_LEFT_TO_RIGHT + +
    +

    Bottom to top, left to right.

    +
    +
    BOTTOM_TO_TOP_RIGHT_TO_LEFT + +
    +

    Bottom to top, right to left.

    +
    +
    OUTSIDE_ROW_TO_MIDDLE + +
    +

    Outside row to middle.

    +
    +
    MIDDLE_ROW_TO_OUTSIDE + +
    +

    Middle row to outside.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    class CharacterSort(Enum):
    +    """An enum for specifying character sorts.
    +
    +    Attributes:
    +        RANDOM: Random order.
    +        TOP_TO_BOTTOM_LEFT_TO_RIGHT: Top to bottom, left to right.
    +        TOP_TO_BOTTOM_RIGHT_TO_LEFT: Top to bottom, right to left.
    +        BOTTOM_TO_TOP_LEFT_TO_RIGHT: Bottom to top, left to right.
    +        BOTTOM_TO_TOP_RIGHT_TO_LEFT: Bottom to top, right to left.
    +        OUTSIDE_ROW_TO_MIDDLE: Outside row to middle.
    +        MIDDLE_ROW_TO_OUTSIDE: Middle row to outside.
    +    """
    +
    +    RANDOM = auto()
    +    TOP_TO_BOTTOM_LEFT_TO_RIGHT = auto()
    +    TOP_TO_BOTTOM_RIGHT_TO_LEFT = auto()
    +    BOTTOM_TO_TOP_LEFT_TO_RIGHT = auto()
    +    BOTTOM_TO_TOP_RIGHT_TO_LEFT = auto()
    +    OUTSIDE_ROW_TO_MIDDLE = auto()
    +    MIDDLE_ROW_TO_OUTSIDE = auto()
    +
    +
    + + + +
    + + + + + + + + + + + +
    + +
    + + +
    + + + +
    + + + +

    + __init__(input_data, config=None) + +

    + + +
    + +

    Initializes the Terminal object.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    input_data + str + +
    +

    The input data to be displayed in the terminal.

    +
    +
    + required +
    config + TerminalConfig + +
    +

    Configuration for the terminal. Defaults to None.

    +
    +
    + None +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def __init__(self, input_data: str, config: TerminalConfig | None = None):
    +    """Initializes the Terminal object.
    +
    +    Args:
    +        input_data (str): The input data to be displayed in the terminal.
    +        config (TerminalConfig, optional): Configuration for the terminal. Defaults to None.
    +    """
    +    if config is None:
    +        self.config = TerminalConfig()
    +    else:
    +        self.config = config
    +    if not input_data:
    +        input_data = "No Input."
    +    self._input_data = input_data.replace("\t", " " * self.config.tab_width)
    +    if self.config.ignore_terminal_dimensions:
    +        self._width = max([len(line) for line in self._input_data.splitlines()])
    +        self._height = len(self._input_data.splitlines()) + 1
    +    elif self.config.terminal_dimensions == (0, 0):
    +        self._width, self._height = self._get_terminal_dimensions()
    +    else:
    +        self._width, self._height = self.config.terminal_dimensions
    +    self._next_character_id = 0
    +    self._input_characters = self._decompose_input(self.config.xterm_colors, self.config.no_color)
    +    self._added_characters: list[EffectCharacter] = []
    +    self._input_width = max([character.input_coord.column for character in self._input_characters])
    +    self._input_height = max([character.input_coord.row for character in self._input_characters])
    +    self.output_area = OutputArea(min(self._height - 1, self._input_height), self._input_width)
    +    self._input_characters = [
    +        character
    +        for character in self._input_characters
    +        if character.input_coord.row <= self.output_area.top
    +        and character.input_coord.column <= self.output_area.right
    +    ]
    +    self.character_by_input_coord: dict[Coord, EffectCharacter] = {
    +        (character.input_coord): character for character in self._input_characters
    +    }
    +    self._fill_characters = self._make_fill_characters()
    +    self._visible_characters: set[EffectCharacter] = set()
    +    self._frame_rate = self.config.frame_rate
    +    self._last_time_printed = time.time()
    +    self._update_terminal_state()
    +
    +
    +
    + +
    + + +
    + + + +

    + add_character(symbol, coord) + +

    + + +
    + +

    Adds a character to the terminal for printing. Used to create characters that are not in the input data.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    symbol + str + +
    +

    symbol to add

    +
    +
    + required +
    coord + Coord + +
    +

    (Coord): set character's input coordinates

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    EffectCharacter + EffectCharacter + +
    +

    the character that was added

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def add_character(self, symbol: str, coord: Coord) -> EffectCharacter:
    +    """Adds a character to the terminal for printing. Used to create characters that are not in the input data.
    +
    +    Args:
    +        symbol (str): symbol to add
    +        coord: (Coord): set character's input coordinates
    +
    +    Returns:
    +        EffectCharacter: the character that was added
    +    """
    +    character = EffectCharacter(self._next_character_id, symbol, coord.column, coord.row)
    +    character.animation.use_xterm_colors = self.config.xterm_colors
    +    character.animation.no_color = self.config.no_color
    +    self._added_characters.append(character)
    +    self._next_character_id += 1
    +    return character
    +
    +
    +
    + +
    + + +
    + + + +

    + get_character_by_input_coord(coord) + +

    + + +
    + +

    Get an EffectCharacter by its input coordinates.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    coord + Coord + +
    +

    input coordinates of the character

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + EffectCharacter | None + +
    +

    EffectCharacter | None: the character at the specified coordinates, or None if no character is found

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def get_character_by_input_coord(self, coord: Coord) -> EffectCharacter | None:
    +    """Get an EffectCharacter by its input coordinates.
    +
    +    Args:
    +        coord (Coord): input coordinates of the character
    +
    +    Returns:
    +        EffectCharacter | None: the character at the specified coordinates, or None if no character is found
    +    """
    +    if coord not in self.character_by_input_coord:
    +        return None
    +    return self.character_by_input_coord[coord]
    +
    +
    +
    + +
    + + +
    + + + +

    + get_characters(*, input_characters=True, fill_chars=False, added_chars=False, sort=CharacterSort.TOP_TO_BOTTOM_LEFT_TO_RIGHT) + +

    + + +
    + +

    Get a list of all EffectCharacters in the terminal with an optional sort.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    input_characters + bool + +
    +

    whether to include input characters. Defaults to True.

    +
    +
    + True +
    fill_chars + bool + +
    +

    whether to include fill characters. Defaults to False.

    +
    +
    + False +
    added_chars + bool + +
    +

    whether to include added characters. Defaults to False.

    +
    +
    + False +
    sort + CharacterSort + +
    +

    order to sort the characters. Defaults to CharacterSort.TOP_TO_BOTTOM_LEFT_TO_RIGHT.

    +
    +
    + TOP_TO_BOTTOM_LEFT_TO_RIGHT +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + list[EffectCharacter] + +
    +

    list[EffectCharacter]: list of EffectCharacters in the terminal

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def get_characters(
    +    self,
    +    *,
    +    input_characters: bool = True,
    +    fill_chars: bool = False,
    +    added_chars: bool = False,
    +    sort: CharacterSort = CharacterSort.TOP_TO_BOTTOM_LEFT_TO_RIGHT,
    +) -> list[EffectCharacter]:
    +    """Get a list of all EffectCharacters in the terminal with an optional sort.
    +
    +    Args:
    +        input_characters (bool, optional): whether to include input characters. Defaults to True.
    +        fill_chars (bool, optional): whether to include fill characters. Defaults to False.
    +        added_chars (bool, optional): whether to include added characters. Defaults to False.
    +        sort (CharacterSort, optional): order to sort the characters. Defaults to CharacterSort.TOP_TO_BOTTOM_LEFT_TO_RIGHT.
    +
    +    Returns:
    +        list[EffectCharacter]: list of EffectCharacters in the terminal
    +    """
    +    all_characters: list[EffectCharacter] = []
    +    if input_characters:
    +        all_characters.extend(self._input_characters)
    +    if fill_chars:
    +        all_characters.extend(self._fill_characters)
    +    if added_chars:
    +        all_characters.extend(self._added_characters)
    +
    +    # default sort TOP_TO_BOTTOM_LEFT_TO_RIGHT
    +    all_characters.sort(key=lambda character: (-character.input_coord.row, character.input_coord.column))
    +
    +    if sort is self.CharacterSort.RANDOM:
    +        random.shuffle(all_characters)
    +
    +    elif sort in (self.CharacterSort.TOP_TO_BOTTOM_LEFT_TO_RIGHT, self.CharacterSort.BOTTOM_TO_TOP_RIGHT_TO_LEFT):
    +        if sort is self.CharacterSort.BOTTOM_TO_TOP_RIGHT_TO_LEFT:
    +            all_characters.reverse()
    +
    +    elif sort in (self.CharacterSort.BOTTOM_TO_TOP_LEFT_TO_RIGHT, self.CharacterSort.TOP_TO_BOTTOM_RIGHT_TO_LEFT):
    +        all_characters.sort(key=lambda character: (character.input_coord.row, character.input_coord.column))
    +        if sort is self.CharacterSort.TOP_TO_BOTTOM_RIGHT_TO_LEFT:
    +            all_characters.reverse()
    +
    +    elif sort in (self.CharacterSort.OUTSIDE_ROW_TO_MIDDLE, self.CharacterSort.MIDDLE_ROW_TO_OUTSIDE):
    +        all_characters = [
    +            all_characters.pop(0) if i % 2 == 0 else all_characters.pop(-1) for i in range(len(all_characters))
    +        ]
    +        if sort is self.CharacterSort.MIDDLE_ROW_TO_OUTSIDE:
    +            all_characters.reverse()
    +
    +    return all_characters
    +
    +
    +
    + +
    + + +
    + + + +

    + get_characters_grouped(grouping=CharacterGroup.ROW_TOP_TO_BOTTOM, *, input_characters=True, fill_chars=False, added_chars=False) + +

    + + +
    + +

    Get a list of all EffectCharacters grouped by the specified CharacterGroup grouping.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    grouping + CharacterGroup + +
    +

    order to group the characters. Defaults to ROW_TOP_TO_BOTTOM.

    +
    +
    + ROW_TOP_TO_BOTTOM +
    input_characters + bool + +
    +

    whether to include input characters. Defaults to True.

    +
    +
    + True +
    fill_chars + bool + +
    +

    whether to include fill characters. Defaults to False.

    +
    +
    + False +
    added_chars + bool + +
    +

    whether to include added characters. Defaults to False.

    +
    +
    + False +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + list[list[EffectCharacter]] + +
    +

    list[list[EffectCharacter]]: list of lists of EffectCharacters in the terminal. Inner lists correspond to groups as specified in the grouping.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def get_characters_grouped(
    +    self,
    +    grouping: CharacterGroup = CharacterGroup.ROW_TOP_TO_BOTTOM,
    +    *,
    +    input_characters: bool = True,
    +    fill_chars: bool = False,
    +    added_chars: bool = False,
    +) -> list[list[EffectCharacter]]:
    +    """Get a list of all EffectCharacters grouped by the specified CharacterGroup grouping.
    +
    +    Args:
    +        grouping (CharacterGroup, optional): order to group the characters. Defaults to ROW_TOP_TO_BOTTOM.
    +        input_characters (bool, optional): whether to include input characters. Defaults to True.
    +        fill_chars (bool, optional): whether to include fill characters. Defaults to False.
    +        added_chars (bool, optional): whether to include added characters. Defaults to False.
    +
    +    Returns:
    +        list[list[EffectCharacter]]: list of lists of EffectCharacters in the terminal. Inner lists correspond to groups as specified in the grouping.
    +    """
    +    all_characters: list[EffectCharacter] = []
    +    if input_characters:
    +        all_characters.extend(self._input_characters)
    +    if fill_chars:
    +        all_characters.extend(self._fill_characters)
    +    if added_chars:
    +        all_characters.extend(self._added_characters)
    +
    +    all_characters.sort(key=lambda character: (character.input_coord.row, character.input_coord.column))
    +
    +    if grouping in (self.CharacterGroup.COLUMN_LEFT_TO_RIGHT, self.CharacterGroup.COLUMN_RIGHT_TO_LEFT):
    +        columns = []
    +        for column_index in range(self.output_area.right + 1):
    +            characters_in_column = [
    +                character for character in all_characters if character.input_coord.column == column_index
    +            ]
    +            if characters_in_column:
    +                columns.append(characters_in_column)
    +        if grouping == self.CharacterGroup.COLUMN_RIGHT_TO_LEFT:
    +            columns.reverse()
    +        return columns
    +
    +    elif grouping in (self.CharacterGroup.ROW_BOTTOM_TO_TOP, self.CharacterGroup.ROW_TOP_TO_BOTTOM):
    +        rows = []
    +        for row_index in range(self.output_area.top + 1):
    +            characters_in_row = [
    +                character for character in all_characters if character.input_coord.row == row_index
    +            ]
    +            if characters_in_row:
    +                rows.append(characters_in_row)
    +        if grouping == self.CharacterGroup.ROW_TOP_TO_BOTTOM:
    +            rows.reverse()
    +        return rows
    +    elif grouping in (
    +        self.CharacterGroup.DIAGONAL_BOTTOM_LEFT_TO_TOP_RIGHT,
    +        self.CharacterGroup.DIAGONAL_TOP_RIGHT_TO_BOTTOM_LEFT,
    +    ):
    +        diagonals = []
    +        for diagonal_index in range(self.output_area.top + self.output_area.right + 1):
    +            characters_in_diagonal = [
    +                character
    +                for character in all_characters
    +                if character.input_coord.row + character.input_coord.column == diagonal_index
    +            ]
    +            if characters_in_diagonal:
    +                diagonals.append(characters_in_diagonal)
    +        if grouping == self.CharacterGroup.DIAGONAL_TOP_RIGHT_TO_BOTTOM_LEFT:
    +            diagonals.reverse()
    +        return diagonals
    +    elif grouping in (
    +        self.CharacterGroup.DIAGONAL_TOP_LEFT_TO_BOTTOM_RIGHT,
    +        self.CharacterGroup.DIAGONAL_BOTTOM_RIGHT_TO_TOP_LEFT,
    +    ):
    +        diagonals = []
    +        for diagonal_index in range(
    +            self.output_area.left - self.output_area.top, self.output_area.right - self.output_area.bottom + 1
    +        ):
    +            characters_in_diagonal = [
    +                character
    +                for character in all_characters
    +                if character.input_coord.column - character.input_coord.row == diagonal_index
    +            ]
    +            if characters_in_diagonal:
    +                diagonals.append(characters_in_diagonal)
    +        if grouping == self.CharacterGroup.DIAGONAL_BOTTOM_RIGHT_TO_TOP_LEFT:
    +            diagonals.reverse()
    +        return diagonals
    +    elif grouping in (
    +        self.CharacterGroup.CENTER_TO_OUTSIDE_DIAMONDS,
    +        self.CharacterGroup.OUTSIDE_TO_CENTER_DIAMONDS,
    +    ):
    +        distance_map: dict[int, list[EffectCharacter]] = {}
    +        center_out = []
    +        for character in all_characters:
    +            distance = abs(character.input_coord.column - self.output_area.center.column) + abs(
    +                character.input_coord.row - self.output_area.center.row
    +            )
    +            if distance not in distance_map:
    +                distance_map[distance] = []
    +            distance_map[distance].append(character)
    +        for distance in sorted(
    +            distance_map.keys(), reverse=grouping is self.CharacterGroup.OUTSIDE_TO_CENTER_DIAMONDS
    +        ):
    +            center_out.append(distance_map[distance])
    +        return center_out
    +
    +    else:
    +        raise ValueError(f"Invalid sort_order: {grouping}")
    +
    +
    +
    + +
    + + +
    + + + +

    + get_formatted_output_string() + +

    + + +
    + +

    Get the formatted output string based on the current terminal state.

    +

    This method updates the internal terminal representation state before returning the formatted output string.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    The formatted output string.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def get_formatted_output_string(self) -> str:
    +    """Get the formatted output string based on the current terminal state.
    +
    +    This method updates the internal terminal representation state before returning the formatted output string.
    +
    +    Returns:
    +        str: The formatted output string.
    +    """
    +    self._update_terminal_state()
    +    output_string = "\n".join(self.terminal_state[::-1])
    +    return output_string
    +
    +
    +
    + +
    + + +
    + + + +

    + get_piped_input() + + + staticmethod + + +

    + + +
    + +

    Gets the piped input from stdin.

    +

    This method checks if there is any piped input from the standard input (stdin). +If there is no piped input, it returns an empty string. +If there is piped input, it reads the input data from stdin and returns it as a string.

    +

    The sys.stdin.isatty() check is used to determine if the program is being run interactively +or if there is piped input. When the program is run interactively, sys.stdin.isatty() returns True, +indicating that there is no piped input. In this case, the method returns an empty string.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    The piped input from stdin as a string, or an empty string if there is no piped input.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    @staticmethod
    +def get_piped_input() -> str:
    +    """Gets the piped input from stdin.
    +
    +    This method checks if there is any piped input from the standard input (stdin).
    +    If there is no piped input, it returns an empty string.
    +    If there is piped input, it reads the input data from stdin and returns it as a string.
    +
    +    The `sys.stdin.isatty()` check is used to determine if the program is being run interactively
    +    or if there is piped input. When the program is run interactively, `sys.stdin.isatty()` returns True,
    +    indicating that there is no piped input. In this case, the method returns an empty string.
    +
    +    Returns:
    +        str: The piped input from stdin as a string, or an empty string if there is no piped input.
    +    """
    +    if sys.stdin.isatty():
    +        return ""
    +    return sys.stdin.read()
    +
    +
    +
    + +
    + + +
    + + + +

    + prep_outputarea() + +

    + + +
    + +

    Prepares the terminal for the effect by adding empty lines and hiding the cursor.

    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def prep_outputarea(self) -> None:
    +    """Prepares the terminal for the effect by adding empty lines and hiding the cursor."""
    +    sys.stdout.write(ansitools.HIDE_CURSOR())
    +    print("\n" * self.output_area.top)
    +
    +
    +
    + +
    + + +
    + + + +

    + print(output_string, *, enforce_frame_rate=True) + +

    + + +
    + +

    Prints the current terminal state to stdout while preserving the cursor position.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    output_string + str + +
    +

    The string to be printed.

    +
    +
    + required +
    enforce_frame_rate + bool + +
    +

    Whether to enforce the frame rate set in the terminal config. Defaults to True.

    +
    +
    + True +
    + +
    + Notes +

    This method includes animation timing to control the frame rate. +If the time since the last print is less than required to limit the frame rate, the method will sleep for the remaining time +to ensure a consistent animation speed.

    +
    +
    + Source code in terminaltexteffects/engine/terminal.py +
    def print(self, output_string: str, *, enforce_frame_rate: bool = True):
    +    """Prints the current terminal state to stdout while preserving the cursor position.
    +
    +    Args:
    +        output_string (str): The string to be printed.
    +        enforce_frame_rate (bool, optional): Whether to enforce the frame rate set in the terminal config. Defaults to True.
    +
    +    Notes:
    +        This method includes animation timing to control the frame rate.
    +        If the time since the last print is less than required to limit the frame rate, the method will sleep for the remaining time
    +        to ensure a consistent animation speed.
    +
    +    """
    +    if enforce_frame_rate:
    +        frame_delay = 1 / self._frame_rate
    +        time_since_last_print = time.time() - self._last_time_printed
    +        if time_since_last_print < frame_delay:
    +            time.sleep(frame_delay - time_since_last_print)
    +    sys.stdout.write(ansitools.DEC_SAVE_CURSOR_POSITION())
    +    sys.stdout.write(ansitools.MOVE_CURSOR_UP(self.output_area.top))
    +    sys.stdout.write(ansitools.MOVE_CURSOR_TO_COLUMN(1))
    +    sys.stdout.write(output_string)
    +    sys.stdout.write(ansitools.DEC_RESTORE_CURSOR_POSITION())
    +    sys.stdout.flush()
    +    self._last_time_printed = time.time()
    +
    +
    +
    + +
    + + +
    + + + +

    + restore_cursor() + +

    + + +
    + +

    Restores the cursor visibility.

    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def restore_cursor(self) -> None:
    +    """Restores the cursor visibility."""
    +    sys.stdout.write(ansitools.SHOW_CURSOR())
    +
    +
    +
    + +
    + + +
    + + + +

    + set_character_visibility(character, is_visible) + +

    + + +
    + +

    Set the visibility of a character.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    character + EffectCharacter + +
    +

    the character to set visibility for

    +
    +
    + required +
    is_visible + bool + +
    +

    whether the character should be visible

    +
    +
    + required +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    def set_character_visibility(self, character: EffectCharacter, is_visible: bool) -> None:
    +    """Set the visibility of a character.
    +
    +    Args:
    +        character (EffectCharacter): the character to set visibility for
    +        is_visible (bool): whether the character should be visible
    +    """
    +    character._is_visible = is_visible
    +    if is_visible:
    +        self._visible_characters.add(character)
    +    else:
    +        self._visible_characters.discard(character)
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/terminal/terminalconfig/index.html b/engine/terminal/terminalconfig/index.html new file mode 100755 index 00000000..640a9129 --- /dev/null +++ b/engine/terminal/terminalconfig/index.html @@ -0,0 +1,2321 @@ + + + + + + + + + + + + + + + + + + + + + + + TerminalConfig - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    TerminalConfig

    +

    Module: terminaltexteffects.engine.terminal

    + + +
    + + + + +
    +

    + Bases: ArgsDataClass

    + + +

    Configuration for the terminal.

    + + + +

    Attributes:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    tab_width + int + +
    +

    Number of spaces to use for a tab character.

    +
    +
    xterm_colors + bool + +
    +

    Convert any colors specified in RBG hex to the closest XTerm-256 color.

    +
    +
    no_color + bool + +
    +

    Disable all colors in the effect.

    +
    +
    wrap_text + bool + +
    +

    Wrap text wider than the output area width.

    +
    +
    frame_rate + float + +
    +

    Target frame rate for the animation.

    +
    +
    terminal_dimensions + tuple[int, int] + +
    +

    Terminal dimensions as (width, height), if set to (0,0) the terminal dimensions are detected automatically.

    +
    +
    ignore_terminal_dimensions + bool + +
    +

    Ignore the terminal dimensions and use the input data dimensions for the output area.

    +
    +
    + +
    + Source code in terminaltexteffects/engine/terminal.py +
    23
    +24
    +25
    +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
    @dataclass
    +class TerminalConfig(ArgsDataClass):
    +    """Configuration for the terminal.
    +
    +    Attributes:
    +        tab_width (int): Number of spaces to use for a tab character.
    +        xterm_colors (bool): Convert any colors specified in RBG hex to the closest XTerm-256 color.
    +        no_color (bool): Disable all colors in the effect.
    +        wrap_text (bool): Wrap text wider than the output area width.
    +        frame_rate (float): Target frame rate for the animation.
    +        terminal_dimensions (tuple[int, int]): Terminal dimensions as (width, height), if set to (0,0) the terminal dimensions are detected automatically.
    +        ignore_terminal_dimensions (bool): Ignore the terminal dimensions and use the input data dimensions for the output area.
    +    """
    +
    +    tab_width: int = ArgField(
    +        cmd_name=["--tab-width"],
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        metavar=argvalidators.PositiveInt.METAVAR,
    +        default=4,
    +        help="Number of spaces to use for a tab character.",
    +    )  # type: ignore[assignment]
    +
    +    "int : Number of spaces to use for a tab character."
    +
    +    xterm_colors: bool = ArgField(
    +        cmd_name=["--xterm-colors"],
    +        default=False,
    +        action="store_true",
    +        help="Convert any colors specified in RBG hex to the closest XTerm-256 color.",
    +    )  # type: ignore[assignment]
    +
    +    "bool : Convert any colors specified in RBG hex to the closest XTerm-256 color."
    +
    +    no_color: bool = ArgField(
    +        cmd_name=["--no-color"], default=False, action="store_true", help="Disable all colors in the effect."
    +    )  # type: ignore[assignment]
    +
    +    "bool : Disable all colors in the effect."
    +
    +    wrap_text: int = ArgField(
    +        cmd_name="--wrap-text", default=False, action="store_true", help="Wrap text wider than the output area width."
    +    )  # type: ignore[assignment]
    +    "bool : Wrap text wider than the output area width."
    +
    +    frame_rate: float = ArgField(
    +        cmd_name="--frame-rate",
    +        type_parser=argvalidators.PositiveInt.type_parser,
    +        default=100,
    +        help="""Target frame rate for the animation.""",
    +    )  # type: ignore[assignment]
    +
    +    "float : Minimum time, in seconds, between frames."
    +
    +    terminal_dimensions: tuple[int, int] = ArgField(
    +        cmd_name=["--terminal-dimensions"],
    +        type_parser=argvalidators.TerminalDimensions.type_parser,
    +        nargs=2,
    +        default=(0, 0),
    +        help="Use the terminal dimensions to limit the size of the output area and support wrapping. If False, the output area is determined by the input data dimensions and may overflow the terminal width.",
    +    )  # type: ignore[assignment]
    +
    +    "tuple(int,int) : Terminal dimensions as (width, height), if set to (0,0) the terminal dimensions are detected automatically."
    +
    +    ignore_terminal_dimensions: bool = ArgField(
    +        cmd_name=["--ignore-terminal-dimensions"],
    +        default=False,
    +        action="store_true",
    +        help="Ignore the terminal dimensions and use the input data dimensions for the output area.",
    +    )  # type: ignore[assignment]
    +    "bool : Ignore the terminal dimensions and use the input data dimensions for the output area."
    +
    +
    + + + +
    + + + + + + + +
    + + + +

    + frame_rate: float = ArgField(cmd_name='--frame-rate', type_parser=argvalidators.PositiveInt.type_parser, default=100, help='Target frame rate for the animation.') + + + class-attribute + instance-attribute + + +

    + + +
    + +

    float : Minimum time, in seconds, between frames.

    +
    + +
    + +
    + + + +

    + ignore_terminal_dimensions: bool = ArgField(cmd_name=['--ignore-terminal-dimensions'], default=False, action='store_true', help='Ignore the terminal dimensions and use the input data dimensions for the output area.') + + + class-attribute + instance-attribute + + +

    + + +
    + +

    bool : Ignore the terminal dimensions and use the input data dimensions for the output area.

    +
    + +
    + +
    + + + +

    + no_color: bool = ArgField(cmd_name=['--no-color'], default=False, action='store_true', help='Disable all colors in the effect.') + + + class-attribute + instance-attribute + + +

    + + +
    + +

    bool : Disable all colors in the effect.

    +
    + +
    + +
    + + + +

    + tab_width: int = ArgField(cmd_name=['--tab-width'], type_parser=argvalidators.PositiveInt.type_parser, metavar=argvalidators.PositiveInt.METAVAR, default=4, help='Number of spaces to use for a tab character.') + + + class-attribute + instance-attribute + + +

    + + +
    + +

    int : Number of spaces to use for a tab character.

    +
    + +
    + +
    + + + +

    + terminal_dimensions: tuple[int, int] = ArgField(cmd_name=['--terminal-dimensions'], type_parser=argvalidators.TerminalDimensions.type_parser, nargs=2, default=(0, 0), help='Use the terminal dimensions to limit the size of the output area and support wrapping. If False, the output area is determined by the input data dimensions and may overflow the terminal width.') + + + class-attribute + instance-attribute + + +

    + + +
    + +

    tuple(int,int) : Terminal dimensions as (width, height), if set to (0,0) the terminal dimensions are detected automatically.

    +
    + +
    + +
    + + + +

    + wrap_text: int = ArgField(cmd_name='--wrap-text', default=False, action='store_true', help='Wrap text wider than the output area width.') + + + class-attribute + instance-attribute + + +

    + + +
    + +

    bool : Wrap text wider than the output area width.

    +
    + +
    + +
    + + + +

    + xterm_colors: bool = ArgField(cmd_name=['--xterm-colors'], default=False, action='store_true', help='Convert any colors specified in RBG hex to the closest XTerm-256 color.') + + + class-attribute + instance-attribute + + +

    + + +
    + +

    bool : Convert any colors specified in RBG hex to the closest XTerm-256 color.

    +
    + +
    + + + + + +
    + +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/utils/ansitools/index.html b/engine/utils/ansitools/index.html new file mode 100755 index 00000000..563caa9b --- /dev/null +++ b/engine/utils/ansitools/index.html @@ -0,0 +1,3044 @@ + + + + + + + + + + + + + + + + + + + + + + + ANSItools - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + + + + + +
    +
    + + + + +

    ANSItools

    +

    Module: terminaltexteffects.utils.ansitools

    + + +
    + + + + +
    + +

    This module provides a collection of functions that generate ANSI escape codes for various terminal formatting effects. +These escape codes can be used to modify the appearance of text in a terminal.

    + + + +
    + + + + + + + + + + +
    + + + + + + +
    + +

    Applies blink formatting.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    def APPLY_BLINK() -> str:
    +    """Applies blink formatting.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\033[5m"
    +
    +
    +
    + +
    + + +
    + + + +

    + APPLY_BOLD() + +

    + + +
    + +

    Applies bold formatting.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    75
    +76
    +77
    +78
    +79
    +80
    +81
    def APPLY_BOLD() -> str:
    +    """Applies bold formatting.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\033[1m"
    +
    +
    +
    + +
    + + +
    + + + +

    + APPLY_DIM() + +

    + + +
    + +

    Applies dim formatting.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    84
    +85
    +86
    +87
    +88
    +89
    +90
    def APPLY_DIM() -> str:
    +    """Applies dim formatting.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\033[2m"
    +
    +
    +
    + +
    + + +
    + + + +

    + APPLY_HIDDEN() + +

    + + +
    + +

    Applies hidden formatting.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    def APPLY_HIDDEN() -> str:
    +    """Applies hidden formatting.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\033[8m"
    +
    +
    +
    + +
    + + +
    + + + +

    + APPLY_ITALIC() + +

    + + +
    + +

    Applies italic formatting.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    93
    +94
    +95
    +96
    +97
    +98
    +99
    def APPLY_ITALIC() -> str:
    +    """Applies italic formatting.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\033[3m"
    +
    +
    +
    + +
    + + +
    + + + +

    + APPLY_REVERSE() + +

    + + +
    + +

    Applies reverse formatting.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    def APPLY_REVERSE() -> str:
    +    """Applies reverse formatting.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\033[7m"
    +
    +
    +
    + +
    + + +
    + + + +

    + APPLY_STRIKETHROUGH() + +

    + + +
    + +

    Applies strikethrough formatting.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    def APPLY_STRIKETHROUGH() -> str:
    +    """Applies strikethrough formatting.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\033[9m"
    +
    +
    +
    + +
    + + +
    + + + +

    + APPLY_UNDERLINE() + +

    + + +
    + +

    Applies underline formatting.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    def APPLY_UNDERLINE() -> str:
    +    """Applies underline formatting.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\033[4m"
    +
    +
    +
    + +
    + + +
    + + + +

    + DEC_RESTORE_CURSOR_POSITION() + +

    + + +
    + +

    Restores the cursor position using DEC sequence.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    15
    +16
    +17
    +18
    +19
    +20
    +21
    def DEC_RESTORE_CURSOR_POSITION() -> str:
    +    """Restores the cursor position using DEC sequence.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\0338"
    +
    +
    +
    + +
    + + +
    + + + +

    + DEC_SAVE_CURSOR_POSITION() + +

    + + +
    + +

    Saves the cursor position using DEC sequence.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
     6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    def DEC_SAVE_CURSOR_POSITION() -> str:
    +    """Saves the cursor position using DEC sequence.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\0337"
    +
    +
    +
    + +
    + + +
    + + + +

    + HIDE_CURSOR() + +

    + + +
    + +

    Hides the cursor.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    24
    +25
    +26
    +27
    +28
    +29
    +30
    def HIDE_CURSOR() -> str:
    +    """Hides the cursor.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\033[?25l"
    +
    +
    +
    + +
    + + +
    + + + +

    + MOVE_CURSOR_TO_COLUMN(x) + +

    + + +
    + +

    Moves the cursor to the x column.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    x + int + +
    +

    column number

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    def MOVE_CURSOR_TO_COLUMN(x: int) -> str:
    +    """Moves the cursor to the x column.
    +
    +    Args:
    +        x (int): column number
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return f"\033[{x}G"
    +
    +
    +
    + +
    + + +
    + + + +

    + MOVE_CURSOR_UP(y) + +

    + + +
    + +

    Moves the cursor up y lines.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    y + int + +
    +

    number of lines to move up

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    def MOVE_CURSOR_UP(y: int) -> str:
    +    """Moves the cursor up y lines.
    +
    +    Args:
    +        y (int): number of lines to move up
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return f"\033[{y}A"
    +
    +
    +
    + +
    + + +
    + + + +

    + RESET_ALL() + +

    + + +
    + +

    Resets all formatting.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    66
    +67
    +68
    +69
    +70
    +71
    +72
    def RESET_ALL() -> str:
    +    """Resets all formatting.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\033[0m"
    +
    +
    +
    + +
    + + +
    + + + +

    + SHOW_CURSOR() + +

    + + +
    + +

    Shows the cursor.

    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    ANSI escape code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/ansitools.py +
    33
    +34
    +35
    +36
    +37
    +38
    +39
    def SHOW_CURSOR() -> str:
    +    """Shows the cursor.
    +
    +    Returns:
    +        str: ANSI escape code
    +    """
    +    return "\033[?25h"
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/utils/argsdataclass/index.html b/engine/utils/argsdataclass/index.html new file mode 100755 index 00000000..5e3c643d --- /dev/null +++ b/engine/utils/argsdataclass/index.html @@ -0,0 +1,2864 @@ + + + + + + + + + + + + + + + + + + + + + + + ArgsDataClass - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    ArgsDataClass

    +

    Module: terminaltexteffects.utils.argsdataclass

    + + +
    + + + + +
    + +

    This module defines classes and functions designed to work with the argparse library and enable typed arguments to support interacting with terminaltexteffects as both a command line tool and a library.

    +

    The ArgField class extends the built-in Field class to include additional metadata specific to command-line arguments. +This metadata includes the command-line argument name, help text, type parser, metavar, nargs, action, required status, +and choices.

    +

    The ArgParserDescriptor dataclass contains required attributes to call the "add_parser()" method of the _argparse._SubParsersAction class.

    +

    The ArgsDataClass dataclass represents command-line arguments and provides methods for handling them. It does not define any fields itself but is meant to be subclassed, with subclasses defining their own fields to represent the command-line arguments they expect.

    + + + +

    Classes:

    + + + + + + + + + + + + + + + + + + + + + +
    NameDescription
    ArgField +
    +

    A subclass of the dataclasses.Field class that represents a command-line argument.

    +
    +
    ArgParserDescriptor +
    +

    A dataclass that contains required attributes to call "add_parser()" method of the _argparse._SubParsersAction" class.

    +
    +
    ArgsDataClass +
    +

    A dataclass that represents command-line arguments and provides methods for handling them.

    +
    +
    + + + +
    + + + + + + + + +
    + + + +

    + ArgField + + +

    + + +
    +

    + Bases: Field

    + + +

    A subclass of the dataclasses.Field class that represents a command-line argument.

    +

    This class extends the built-in Field class to include additional metadata specific to command-line arguments. +This metadata includes the command-line argument name, help text, type parser, metavar, nargs, action, required +status, and choices.

    +

    The class also overrides the init method to handle the additional metadata and to set default values based on +the 'action' attribute. If 'action' is "store_true", the default value is set to False. If 'action' is "store_false", +the default value is set to True.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    cmd_name + str | list[str] + +
    +

    The name or names of the command-line argument.

    +
    +
    + required +
    help + str + +
    +

    The help text to display for the argument.

    +
    +
    + required +
    type_parser + Any + +
    +

    The validator to use to validate the argument. Defaults to None.

    +
    +
    + None +
    metavar + str | None + +
    +

    A name for the argument in usage messages. Defaults to None.

    +
    +
    + None +
    nargs + str | None + +
    +

    The number of command-line arguments that should be consumed. Defaults to None.

    +
    +
    + None +
    action + str | None + +
    +

    The basic type of action to be taken when this argument is encountered at the + command line. Defaults to None.

    +
    +
    + None +
    required + bool + +
    +

    Whether or not the command-line option is required. Defaults to False.

    +
    +
    + False +
    choices + list[str | int] | None + +
    +

    A container of the allowable values for the argument. Defaults to None.

    +
    +
    + None +
    default + any + +
    +

    The value produced if the argument is absent from the command line. Defaults to MISSING.

    +
    +
    + MISSING +
    default_factory + any + +
    +

    A function that is called to provide the default value. Defaults to MISSING.

    +
    +
    + MISSING +
    init + bool + +
    +

    If true (the default), this field is included as a parameter to the generated init + method. Defaults to True.

    +
    +
    + True +
    repr + bool + +
    +

    If true (the default), this field is included in the string returned by the generated + repr method. Defaults to True.

    +
    +
    + True +
    hash + bool | None + +
    +

    This can be a bool or None. If true, this field is included in the generated + hash method. Defaults to None.

    +
    +
    + None +
    compare + bool + +
    +

    If true (the default), this field is included in the generated equality and comparison + methods (eq, gt, etc.). Defaults to True.

    +
    +
    + True +
    kw_only + bool + +
    +

    If true, this field must be passed as a keyword argument. Defaults to MISSING.

    +
    +
    + MISSING +
    + +
    + Source code in terminaltexteffects/utils/argsdataclass.py +
    class ArgField(Field):
    +    """
    +    A subclass of the dataclasses.Field class that represents a command-line argument.
    +
    +    This class extends the built-in Field class to include additional metadata specific to command-line arguments.
    +    This metadata includes the command-line argument name, help text, type parser, metavar, nargs, action, required
    +    status, and choices.
    +
    +    The class also overrides the __init__ method to handle the additional metadata and to set default values based on
    +    the 'action' attribute. If 'action' is "store_true", the default value is set to False. If 'action' is "store_false",
    +    the default value is set to True.
    +
    +    Args:
    +        cmd_name (str | list[str]): The name or names of the command-line argument.
    +        help (str): The help text to display for the argument.
    +        type_parser (typing.Any, optional): The validator to use to validate the argument. Defaults to None.
    +        metavar (str | None, optional): A name for the argument in usage messages. Defaults to None.
    +        nargs (str | None, optional): The number of command-line arguments that should be consumed. Defaults to None.
    +        action (str | None, optional): The basic type of action to be taken when this argument is encountered at the
    +                                       command line. Defaults to None.
    +        required (bool, optional): Whether or not the command-line option is required. Defaults to False.
    +        choices (list[str | int] | None, optional): A container of the allowable values for the argument. Defaults to None.
    +        default (any, optional): The value produced if the argument is absent from the command line. Defaults to MISSING.
    +        default_factory (any, optional): A function that is called to provide the default value. Defaults to MISSING.
    +        init (bool, optional): If true (the default), this field is included as a parameter to the generated __init__
    +                               method. Defaults to True.
    +        repr (bool, optional): If true (the default), this field is included in the string returned by the generated
    +                               __repr__ method. Defaults to True.
    +        hash (bool | None, optional): This can be a bool or None. If true, this field is included in the generated
    +                                      __hash__ method. Defaults to None.
    +        compare (bool, optional): If true (the default), this field is included in the generated equality and comparison
    +                                  methods (__eq__, __gt__, etc.). Defaults to True.
    +        kw_only (bool, optional): If true, this field must be passed as a keyword argument. Defaults to MISSING.
    +    """
    +
    +    def __init__(
    +        self,
    +        # custom metadata
    +        cmd_name: str | list[str],
    +        help: str,
    +        type_parser: typing.Callable | None = None,
    +        metavar: str | None = None,
    +        nargs: str | int | None = None,
    +        action: str | None = None,
    +        required: bool = False,
    +        choices: list[str | int] | None = None,
    +        # python internal attrs
    +        default=MISSING,
    +        default_factory=MISSING,
    +        init=True,
    +        repr=True,
    +        hash=None,
    +        compare=True,
    +        kw_only=MISSING,
    +    ):
    +        additional_metadata = ArgField.FieldAdditionalMetaData(
    +            cmd_name=cmd_name,
    +            type_parser=type_parser,
    +            metavar=metavar,
    +            nargs=nargs,
    +            help=help,
    +            action=action,
    +            required=required,
    +            choices=choices,
    +        )
    +        if action == "store_true":
    +            default = False
    +        elif action == "store_false":
    +            default = True
    +
    +        super().__init__(default, default_factory, init, repr, hash, compare, vars(additional_metadata), kw_only)
    +
    +    @dataclass
    +    class FieldAdditionalMetaData:
    +        cmd_name: str | list[str]
    +        type_parser: typing.Any | None = None
    +        metavar: str | None = None
    +        nargs: str | int | None = None
    +        help: str | None = None
    +        action: str | None = None
    +        required: bool = False
    +        choices: list[str | int] | None = None
    +
    +
    + + + +
    + + + + + + + + + + + +
    + +
    + + +
    + +
    + + + +

    + ArgParserDescriptor + + + + dataclass + + +

    + + +
    + + +

    This dataclass contains required attributes to call "add_parser()" method of +_argparse._SubParsersAction" class

    + +
    + Source code in terminaltexteffects/utils/argsdataclass.py +
    @dataclass
    +class ArgParserDescriptor:
    +    """This dataclass contains required attributes to call "add_parser()" method of
    +    _argparse._SubParsersAction" class
    +    """
    +
    +    name: str
    +    help: str
    +    description: str
    +    epilog: str
    +
    +
    + + + +
    + + + + + + + + + + + +
    + +
    + + +
    + +
    + + + +

    + ArgsDataClass + + + + dataclass + + +

    + + +
    + + +

    A dataclass that represents command-line arguments and provides methods for handling them.

    +

    This class provides a structured way to define and work with command-line arguments. It uses Python's built-in +dataclasses and the argparse module to parse command-line arguments and create an instance of the class from them.

    + +
    + Note +

    This class does not define any fields itself. Instead, it is meant to be subclassed, with subclasses defining +their own fields to represent the command-line arguments they expect.

    +
    +
    + Source code in terminaltexteffects/utils/argsdataclass.py +
    @dataclass
    +class ArgsDataClass:
    +    """
    +    A dataclass that represents command-line arguments and provides methods for handling them.
    +
    +    This class provides a structured way to define and work with command-line arguments. It uses Python's built-in
    +    dataclasses and the argparse module to parse command-line arguments and create an instance of the class from them.
    +
    +    Note:
    +        This class does not define any fields itself. Instead, it is meant to be subclassed, with subclasses defining
    +        their own fields to represent the command-line arguments they expect.
    +    """
    +
    +    @classmethod
    +    def _from_parsed_args_mapping(cls, parsed_args: argparse.Namespace, arg_class=None):
    +        """
    +        Creates an instance of the ArgsDataClass from parsed command-line arguments.
    +
    +        This method takes a Namespace object, which is the result of parsing command-line arguments with argparse, and an
    +        optional class to instantiate. If no class is provided, it uses the 'arg_class' attribute from the parsed_args.
    +
    +        It retrieves the signature of the __init__ method of the target class and iterates over its parameters. For each
    +        parameter, it gets the corresponding value from the parsed_args. If the value is a list (which can happen if the
    +        argument was defined with nargs="+" or nargs="*"), it converts the list to a tuple.
    +
    +        It then creates a new instance of the target class, passing the collected parameters as keyword arguments.
    +
    +        Args:
    +            parsed_args (argparse.Namespace): The parsed command-line arguments.
    +            arg_class (Optional[Type]): The class to instantiate. If None, uses 'arg_class' attribute from parsed_args.
    +
    +        Returns:
    +            An instance of the target class, initialized with values from the parsed_args.
    +
    +        Note:
    +            This method assumes that the names of the command-line arguments match the parameter names of the target class's
    +            __init__ method. If this is not the case, it may not work as expected.
    +        """
    +        if arg_class is None:
    +            arg_class = parsed_args.arg_class
    +
    +        signature = inspect.signature(arg_class.__init__)
    +        parameters = signature.parameters
    +        params_dict = {}
    +        for param in parameters:
    +            if param == "self":
    +                continue
    +            param_value = getattr(parsed_args, param)
    +            if isinstance(param_value, list):  # argparser returns list for nargs="+" or nargs="*"
    +                param_value = tuple(param_value)
    +            params_dict[param] = param_value
    +
    +        new_instance = arg_class(**params_dict)
    +        return new_instance
    +
    +    @classmethod
    +    def _get_all_fields(cls) -> dict[str, Field]:
    +        """
    +        Retrieves all fields defined in the ArgsDataClass and returns them as a dictionary.
    +
    +        This method uses the `fields` function from the `dataclasses` module to get a list of all fields defined in the
    +        ArgsDataClass. It then iterates over these fields, adding each one to a dictionary with the field's name as the key
    +        and the field itself as the value.
    +
    +        Returns:
    +            dict[str, Field]: A dictionary mapping field names to their corresponding Field objects. Each Field object
    +                            contains information about the field, such as its name, type, and any default values or
    +                            metadata it may have.
    +        """
    +        fields_list = {}
    +        for f in fields(cls):
    +            fields_list[f.name] = f
    +
    +        return fields_list
    +
    +    @classmethod
    +    def _add_args_to_parser(cls, parser: argparse.ArgumentParser):
    +        """
    +        Adds arguments to the provided parser based on the fields defined in the ArgsDataClass.
    +
    +        This method iterates over all fields in the ArgsDataClass. For each field, it checks if it has metadata.
    +        If metadata is present, it creates an instance of FieldAdditionalMetaData using the metadata.
    +        It then prepares a dictionary of argument descriptors, mapping field names to their corresponding values.
    +        These descriptors are used to add an argument to the parser with the `add_argument` method.
    +
    +        Args:
    +            parser (argparse.ArgumentParser): The parser to which arguments will be added. Each argument corresponds
    +                                            to a field in the ArgsDataClass, and the argument's properties are
    +                                            determined by the field's metadata.
    +
    +        Note:
    +            The 'type_parser' field name is specially handled and mapped to 'type' in the argument descriptors.
    +            The 'cmd_name' field is used as the name of the argument added to the parser. If 'cmd_name' is a string,
    +            it is wrapped in a list before being passed to `add_argument`.
    +            If a field has no metadata, it is skipped and no corresponding argument is added to the parser.
    +        """
    +        arg_fields = cls._get_all_fields()
    +        for arg in arg_fields.values():
    +            if not arg.metadata:
    +                continue
    +            additional_metadata = ArgField.FieldAdditionalMetaData(**arg.metadata)
    +            if isinstance(additional_metadata.cmd_name, str):
    +                additional_metadata.cmd_name = [additional_metadata.cmd_name]
    +            field_names_mapping = {"type_parser": "type"}
    +            arg_descriptor = {}
    +            for attr_name in vars(additional_metadata):
    +                value = getattr(additional_metadata, attr_name)
    +                if value is None:
    +                    continue
    +                if attr_name == "cmd_name":
    +                    continue
    +                if attr_name in field_names_mapping:
    +                    attr_name = field_names_mapping[attr_name]
    +
    +                arg_descriptor[attr_name] = value
    +
    +            parser.add_argument(*additional_metadata.cmd_name, **arg_descriptor, default=arg.default)
    +        parser.formatter_class = CustomFormatter
    +
    +    @classmethod
    +    def _add_to_args_subparsers(cls, subparsers: argparse._SubParsersAction):
    +        """Adds arguments to the subparser.
    +
    +        Args:
    +            arg_data_class (ArgsDataClass): ArgDataClass that required args defined in it
    +            subparser (argparse._SubParsersAction): subparser to add arguments to
    +        """
    +        sub_parser_descriptor = getattr(cls, "arg_class_metadata")
    +        new_parser = subparsers.add_parser(**vars(sub_parser_descriptor))
    +        new_parser.set_defaults(arg_class=cls)
    +        cls._add_args_to_parser(new_parser)
    +
    +
    + + + +
    + + + + + + + + + + + +
    + +
    + + +
    + + + +
    + + + +

    + argclass(name, help, description, epilog) + +

    + + +
    + +

    Decorator for providing required metadata to an "ArgDataClass"

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    name + str + +
    +

    name for parser or subparser

    +
    +
    + required +
    help + str + +
    +

    help string for parser or subparser

    +
    +
    + required +
    description + str + +
    +

    description string for parser or subparser

    +
    +
    + required +
    epilog + str + +
    +

    epilog string for parser or subparser

    +
    +
    + required +
    + +
    + Source code in terminaltexteffects/utils/argsdataclass.py +
    def argclass(name: str, help: str, description: str, epilog: str):
    +    """Decorator for providing required metadata to an "ArgDataClass"
    +
    +    Args:
    +        name (str): name for parser or subparser
    +        help (str): help string for parser or subparser
    +        description (str): description string for parser or subparser
    +        epilog (str): epilog string for parser or subparser
    +    """
    +
    +    def decorator(cls):
    +        cls.arg_class_metadata = ArgParserDescriptor(name=name, help=help, description=description, epilog=epilog)
    +        return cls
    +
    +    return decorator
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/utils/argvalidators/index.html b/engine/utils/argvalidators/index.html new file mode 100755 index 00000000..bb6a330e --- /dev/null +++ b/engine/utils/argvalidators/index.html @@ -0,0 +1,5974 @@ + + + + + + + + + + + + + + + + + + + + + + + Argument Validation - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Argument Validation

    +

    Module: terminaltexteffects.utils.argvalidators

    + + +
    + + + + +
    + +

    This module provides command line argument validators and METAVARs for consistent type parsing and help output.

    +

    It includes a custom formatter for argparse, which combines the features of +argparse.ArgumentDefaultsHelpFormatter and argparse.RawDescriptionHelpFormatter.

    + + + +

    Classes:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameDescription
    CustomFormatter +
    +

    A custom formatter for argparse that combines the features of +argparse.ArgumentDefaultsHelpFormatter and argparse.RawDescriptionHelpFormatter.

    +
    +
    GradientDirection +
    +

    Argument type for gradient directions.

    +
    +
    Color +
    +

    Argument type for color values.

    +
    +
    PositiveFloatRange +
    +

    Argument type for float ranges.

    +
    +
    IntRange +
    +

    Argument type for integer ranges.

    +
    +
    Symbol +
    +

    Argument type for single ASCII/UTF-8 characters.

    +
    +
    TerminalDimensions +
    +

    Argument type for terminal dimensions.

    +
    +
    PositiveInt +
    +

    Argument type for positive integers.

    +
    +
    Ease +
    +

    Argument type for easing functions.

    +
    +
    Ratio +
    +

    Argument type for float values between zero and one.

    +
    +
    PositiveFloat +
    +

    Argument type for positive floats.

    +
    +
    NonNegativeInt +
    +

    Argument type for nonnegative integers.

    +
    +
    NonNegativeFloat +
    +

    Argument type for nonnegative floats.

    +
    +
    + + + +

    Functions:

    + + + + + + + + + + + + + +
    NameDescription
    is_ascii_or_utf8 +
    +

    Tests if the given string is either ASCII or UTF-8.

    +
    +
    + +
    + Constants +

    EASING_EPILOG (str): A detailed description of the easing functions supported.

    +
    + + +
    + + + + + + + + +
    + + + +

    + ColorArg + + +

    + + +
    + + +

    Argument type for color values.

    +

    Color values can be either an XTerm color value (0-255) or an RGB hex value (000000-ffffff).

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is not in range of valid XTerm colors or RGB hex colors.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class ColorArg:
    +    """Argument type for color values.
    +
    +    Color values can be either an XTerm color value (0-255) or an RGB hex value (000000-ffffff).
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is not in range of valid XTerm colors or RGB hex colors.
    +    """
    +
    +    METAVAR = "(XTerm [0-255] OR RGB Hex [000000-ffffff])"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> ColorType:
    +        """Validates that the given argument is a valid color value.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Raises:
    +            argparse.ArgumentTypeError: Color value is not in range.
    +
    +        Returns:
    +            Color : validated color value
    +        """
    +        xterm_min = 0
    +        xterm_max = 255
    +        if len(arg) == 6:
    +            # Check if the hex value is a valid color
    +            if not 0 <= int(arg, 16) <= 16777215:
    +                raise argparse.ArgumentTypeError(f"invalid color value: {arg} is not a valid hex color.")
    +            return arg
    +        else:
    +            # Check if the color is a valid xterm color
    +            if not xterm_min <= int(arg) <= xterm_max:
    +                raise argparse.ArgumentTypeError(f"invalid color value: {arg} is not a valid xterm color (0-255).")
    +            return int(arg)
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a valid color value.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Color value is not in range.

    +
    +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Color + Color + +
    +

    validated color value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    @staticmethod
    +def type_parser(arg: str) -> ColorType:
    +    """Validates that the given argument is a valid color value.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Color value is not in range.
    +
    +    Returns:
    +        Color : validated color value
    +    """
    +    xterm_min = 0
    +    xterm_max = 255
    +    if len(arg) == 6:
    +        # Check if the hex value is a valid color
    +        if not 0 <= int(arg, 16) <= 16777215:
    +            raise argparse.ArgumentTypeError(f"invalid color value: {arg} is not a valid hex color.")
    +        return arg
    +    else:
    +        # Check if the color is a valid xterm color
    +        if not xterm_min <= int(arg) <= xterm_max:
    +            raise argparse.ArgumentTypeError(f"invalid color value: {arg} is not a valid xterm color (0-255).")
    +        return int(arg)
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + CustomFormatter + + +

    + + +
    +

    + Bases: ArgumentDefaultsHelpFormatter, RawDescriptionHelpFormatter

    + + +

    Custom formatter for argparse that combines ArgumentDefaultsHelpFormatter and RawDescriptionHelpFormatter.

    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class CustomFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter):
    +    """Custom formatter for argparse that combines ArgumentDefaultsHelpFormatter and RawDescriptionHelpFormatter."""
    +
    +    pass
    +
    +
    + +
    + + +
    + +
    + + + +

    + Ease + + +

    + + +
    + + +

    Argument type for easing functions.

    +

    Easing functions are prefixed by "in", "out", or "in_out" and suffixed by a valid easing function.

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is not a valid easing function.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class Ease:
    +    """Argument type for easing functions.
    +
    +    Easing functions are prefixed by "in", "out", or "in_out" and suffixed by a valid easing function.
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is not a valid easing function.
    +    """
    +
    +    METAVAR = "(Easing Function)"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> typing.Callable:
    +        """Validates that the given argument is a valid easing function.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Raises:
    +            argparse.ArgumentTypeError: Ease value is not a valid easing function.
    +
    +        Returns:
    +            Ease: validated ease value
    +        """
    +        easing_func_map = {
    +            "in_sine": easing.in_sine,
    +            "out_sine": easing.out_sine,
    +            "in_out_sine": easing.in_out_sine,
    +            "in_quad": easing.in_quad,
    +            "out_quad": easing.out_quad,
    +            "in_out_quad": easing.in_out_quad,
    +            "in_cubic": easing.in_cubic,
    +            "out_cubic": easing.out_cubic,
    +            "in_out_cubic": easing.in_out_cubic,
    +            "in_quart": easing.in_quart,
    +            "out_quart": easing.out_quart,
    +            "in_out_quart": easing.in_out_quart,
    +            "in_quint": easing.in_quint,
    +            "out_quint": easing.out_quint,
    +            "in_out_quint": easing.in_out_quint,
    +            "in_expo": easing.in_expo,
    +            "out_expo": easing.out_expo,
    +            "in_out_expo": easing.in_out_expo,
    +            "in_circ": easing.in_circ,
    +            "out_circ": easing.out_circ,
    +            "in_out_circ": easing.in_out_circ,
    +            "in_back": easing.in_back,
    +            "out_back": easing.out_back,
    +            "in_out_back": easing.in_out_back,
    +            "in_elastic": easing.in_elastic,
    +            "out_elastic": easing.out_elastic,
    +            "in_out_elastic": easing.in_out_elastic,
    +            "in_bounce": easing.in_bounce,
    +            "out_bounce": easing.out_bounce,
    +            "in_out_bounce": easing.in_out_bounce,
    +        }
    +
    +        try:
    +            return easing_func_map[arg.lower()]
    +        except KeyError:
    +            raise argparse.ArgumentTypeError(f"invalid ease value: '{arg}' is not a valid ease.")
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a valid easing function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Ease value is not a valid easing function.

    +
    +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Ease + Callable + +
    +

    validated ease value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    @staticmethod
    +def type_parser(arg: str) -> typing.Callable:
    +    """Validates that the given argument is a valid easing function.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Ease value is not a valid easing function.
    +
    +    Returns:
    +        Ease: validated ease value
    +    """
    +    easing_func_map = {
    +        "in_sine": easing.in_sine,
    +        "out_sine": easing.out_sine,
    +        "in_out_sine": easing.in_out_sine,
    +        "in_quad": easing.in_quad,
    +        "out_quad": easing.out_quad,
    +        "in_out_quad": easing.in_out_quad,
    +        "in_cubic": easing.in_cubic,
    +        "out_cubic": easing.out_cubic,
    +        "in_out_cubic": easing.in_out_cubic,
    +        "in_quart": easing.in_quart,
    +        "out_quart": easing.out_quart,
    +        "in_out_quart": easing.in_out_quart,
    +        "in_quint": easing.in_quint,
    +        "out_quint": easing.out_quint,
    +        "in_out_quint": easing.in_out_quint,
    +        "in_expo": easing.in_expo,
    +        "out_expo": easing.out_expo,
    +        "in_out_expo": easing.in_out_expo,
    +        "in_circ": easing.in_circ,
    +        "out_circ": easing.out_circ,
    +        "in_out_circ": easing.in_out_circ,
    +        "in_back": easing.in_back,
    +        "out_back": easing.out_back,
    +        "in_out_back": easing.in_out_back,
    +        "in_elastic": easing.in_elastic,
    +        "out_elastic": easing.out_elastic,
    +        "in_out_elastic": easing.in_out_elastic,
    +        "in_bounce": easing.in_bounce,
    +        "out_bounce": easing.out_bounce,
    +        "in_out_bounce": easing.in_out_bounce,
    +    }
    +
    +    try:
    +        return easing_func_map[arg.lower()]
    +    except KeyError:
    +        raise argparse.ArgumentTypeError(f"invalid ease value: '{arg}' is not a valid ease.")
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + GradientDirection + + +

    + + +
    + + +

    Argument type for gradient directions.

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Argument value is not a valid gradient direction.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class GradientDirection:
    +    """Argument type for gradient directions.
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Argument value is not a valid gradient direction.
    +    """
    +
    +    METAVAR = "(diagonal, horizontal, vertical, center)"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> Gradient.Direction:
    +        """Validates that the given argument is a valid gradient direction.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Returns:
    +            Gradient.Direction: validated gradient direction
    +
    +        Raises:
    +            argparse.ArgumentTypeError: Argument value is not a valid gradient direction.
    +        """
    +        direction_map = {
    +            "horizontal": Gradient.Direction.HORIZONTAL,
    +            "vertical": Gradient.Direction.VERTICAL,
    +            "diagonal": Gradient.Direction.DIAGONAL,
    +            "center": Gradient.Direction.CENTER,
    +        }
    +        if arg.lower() in direction_map:
    +            return direction_map[arg.lower()]
    +        else:
    +            raise argparse.ArgumentTypeError(
    +                f"invalid gradient direction: '{arg}' is not a valid gradient direction. Choices are diagonal, horizontal, vertical, or center."
    +            )
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a valid gradient direction.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + Direction + +
    +

    Gradient.Direction: validated gradient direction

    +
    +
    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Argument value is not a valid gradient direction.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    @staticmethod
    +def type_parser(arg: str) -> Gradient.Direction:
    +    """Validates that the given argument is a valid gradient direction.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Returns:
    +        Gradient.Direction: validated gradient direction
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Argument value is not a valid gradient direction.
    +    """
    +    direction_map = {
    +        "horizontal": Gradient.Direction.HORIZONTAL,
    +        "vertical": Gradient.Direction.VERTICAL,
    +        "diagonal": Gradient.Direction.DIAGONAL,
    +        "center": Gradient.Direction.CENTER,
    +    }
    +    if arg.lower() in direction_map:
    +        return direction_map[arg.lower()]
    +    else:
    +        raise argparse.ArgumentTypeError(
    +            f"invalid gradient direction: '{arg}' is not a valid gradient direction. Choices are diagonal, horizontal, vertical, or center."
    +        )
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + IntRange + + +

    + + +
    + + +

    Argument type for integer ranges.

    +

    Integer ranges are a pair of integers separated by a hyphen. Ex: 1-10

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is not a valid range of integers.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class IntRange:
    +    """Argument type for integer ranges.
    +
    +    Integer ranges are a pair of integers separated by a hyphen. Ex: 1-10
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is not a valid range of integers.
    +    """
    +
    +    METAVAR = "(hyphen separated int range e.g. '1-10')"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> tuple[int, int]:
    +        """Validates that the given argument is a valid range of integers n > 0.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Returns:
    +            tuple[int,int]: validated range
    +        """
    +        try:
    +            start, end = map(int, arg.split("-"))
    +            if start <= 0:
    +                raise argparse.ArgumentTypeError(
    +                    f"invalid range: '{arg}' is not a valid range of ints. Must be start > 0. Ex: 1-10"
    +                )
    +            if start > end:
    +                raise argparse.ArgumentTypeError(
    +                    f"invalid range: '{arg}' is not a valid range of ints. Must be start <= end. Ex: 1-10"
    +                )
    +            return start, end
    +        except ValueError:
    +            raise argparse.ArgumentTypeError(
    +                f"invalid range: '{arg}' is not a valid range. Must be start-end. Ex: 1-10"
    +            )
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a valid range of integers n > 0.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + tuple[int, int] + +
    +

    tuple[int,int]: validated range

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    @staticmethod
    +def type_parser(arg: str) -> tuple[int, int]:
    +    """Validates that the given argument is a valid range of integers n > 0.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Returns:
    +        tuple[int,int]: validated range
    +    """
    +    try:
    +        start, end = map(int, arg.split("-"))
    +        if start <= 0:
    +            raise argparse.ArgumentTypeError(
    +                f"invalid range: '{arg}' is not a valid range of ints. Must be start > 0. Ex: 1-10"
    +            )
    +        if start > end:
    +            raise argparse.ArgumentTypeError(
    +                f"invalid range: '{arg}' is not a valid range of ints. Must be start <= end. Ex: 1-10"
    +            )
    +        return start, end
    +    except ValueError:
    +        raise argparse.ArgumentTypeError(
    +            f"invalid range: '{arg}' is not a valid range. Must be start-end. Ex: 1-10"
    +        )
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + NonNegativeFloat + + +

    + + +
    + + +

    Validates that the given argument is a valid animationrate value. n >= 0.

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Argument value is not in range.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class NonNegativeFloat:
    +    """Validates that the given argument is a valid animationrate value. n >= 0.
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Argument value is not in range.
    +    """
    +
    +    METAVAR = "(float >= 0)"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> float:
    +        """Validates that the given argument is a valid animationrate value. n >= 0.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Raises:
    +            argparse.ArgumentTypeError: Argument value is not in range.
    +
    +        Returns:
    +            float: validated value
    +        """
    +        if float(arg) < 0:
    +            raise argparse.ArgumentTypeError(f"invalid argument value: '{arg}' is out of range. Must be float >= 0.")
    +        return float(arg)
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a valid animationrate value. n >= 0.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Argument value is not in range.

    +
    +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    validated value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    @staticmethod
    +def type_parser(arg: str) -> float:
    +    """Validates that the given argument is a valid animationrate value. n >= 0.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Argument value is not in range.
    +
    +    Returns:
    +        float: validated value
    +    """
    +    if float(arg) < 0:
    +        raise argparse.ArgumentTypeError(f"invalid argument value: '{arg}' is out of range. Must be float >= 0.")
    +    return float(arg)
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + NonNegativeInt + + +

    + + +
    + + +

    Validates that the given argument is a nonnegative integer. n >= 0.

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is not in range.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class NonNegativeInt:
    +    """Validates that the given argument is a nonnegative integer. n >= 0.
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is not in range.
    +    """
    +
    +    METAVAR = "(int >= 0)"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> int:
    +        """Validates that the given argument is a nonnegative integer. n >= 0.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Raises:
    +            argparse.ArgumentTypeError: Value is not in range.
    +
    +        Returns:
    +            int: validated gap value
    +        """
    +        if int(arg) < 0:
    +            raise argparse.ArgumentTypeError(f"invalid value: '{arg}' Argument must be int >= 0.")
    +        return int(arg)
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a nonnegative integer. n >= 0.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is not in range.

    +
    +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    int + int + +
    +

    validated gap value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    @staticmethod
    +def type_parser(arg: str) -> int:
    +    """Validates that the given argument is a nonnegative integer. n >= 0.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is not in range.
    +
    +    Returns:
    +        int: validated gap value
    +    """
    +    if int(arg) < 0:
    +        raise argparse.ArgumentTypeError(f"invalid value: '{arg}' Argument must be int >= 0.")
    +    return int(arg)
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + PositiveFloat + + +

    + + +
    + + +

    Validates that the given argument is a positive float. n > 0.

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is not in range.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class PositiveFloat:
    +    """Validates that the given argument is a positive float. n > 0.
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is not in range.
    +    """
    +
    +    METAVAR = "(float > 0)"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> float:
    +        """Validates that the given argument is a positive float. n > 0.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Raises:
    +            argparse.ArgumentTypeError: value is not in range.
    +
    +        Returns:
    +            float: validated positive float
    +        """
    +        if float(arg) > 0:
    +            return float(arg)
    +        else:
    +            raise argparse.ArgumentTypeError(
    +                f"invalid value: '{arg}' is not a valid value. Argument must be a float > 0."
    +            )
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a positive float. n > 0.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    value is not in range.

    +
    +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    validated positive float

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    @staticmethod
    +def type_parser(arg: str) -> float:
    +    """Validates that the given argument is a positive float. n > 0.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Raises:
    +        argparse.ArgumentTypeError: value is not in range.
    +
    +    Returns:
    +        float: validated positive float
    +    """
    +    if float(arg) > 0:
    +        return float(arg)
    +    else:
    +        raise argparse.ArgumentTypeError(
    +            f"invalid value: '{arg}' is not a valid value. Argument must be a float > 0."
    +        )
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + PositiveFloatRange + + +

    + + +
    + + +

    Argument type for float ranges.

    +

    Float ranges are a pair of positive floats separated by a hyphen. Ex: 0.1-1.0

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is a valid range of floats.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class PositiveFloatRange:
    +    """Argument type for float ranges.
    +
    +    Float ranges are a pair of positive floats separated by a hyphen. Ex: 0.1-1.0
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is a valid range of floats.
    +    """
    +
    +    METAVAR = "(hyphen separated float range e.g. '0.25-0.5')"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> tuple[float, float]:
    +        """Validates that the given argument is a valid range of floats n >= 0.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Returns:
    +            tuple[float,float]: validated range
    +        """
    +        try:
    +            start, end = map(float, arg.split("-"))
    +            if start > end:
    +                raise argparse.ArgumentTypeError(
    +                    f"invalid range: '{arg}' is not a valid range of floats. Must be start <= end. Ex: 0.1-1.0"
    +                )
    +            elif start == 0 or end == 0:
    +                raise argparse.ArgumentTypeError(
    +                    f"invalid range: '{arg}' is not a valid range of floats. Must be start > 0. Ex: 0.1-1.0"
    +                )
    +            return start, end
    +        except ValueError:
    +            raise argparse.ArgumentTypeError(
    +                f"invalid range: '{arg}' is not a valid range. Must be start-end. Ex: 0.1-1.0"
    +            )
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a valid range of floats n >= 0.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + tuple[float, float] + +
    +

    tuple[float,float]: validated range

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    @staticmethod
    +def type_parser(arg: str) -> tuple[float, float]:
    +    """Validates that the given argument is a valid range of floats n >= 0.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Returns:
    +        tuple[float,float]: validated range
    +    """
    +    try:
    +        start, end = map(float, arg.split("-"))
    +        if start > end:
    +            raise argparse.ArgumentTypeError(
    +                f"invalid range: '{arg}' is not a valid range of floats. Must be start <= end. Ex: 0.1-1.0"
    +            )
    +        elif start == 0 or end == 0:
    +            raise argparse.ArgumentTypeError(
    +                f"invalid range: '{arg}' is not a valid range of floats. Must be start > 0. Ex: 0.1-1.0"
    +            )
    +        return start, end
    +    except ValueError:
    +        raise argparse.ArgumentTypeError(
    +            f"invalid range: '{arg}' is not a valid range. Must be start-end. Ex: 0.1-1.0"
    +        )
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + PositiveInt + + +

    + + +
    + + +

    Argument type for positive integers.

    +

    int(n) > 0

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is not a positive integer.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    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
    class PositiveInt:
    +    """Argument type for positive integers.
    +
    +    int(n) > 0
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is not a positive integer.
    +    """
    +
    +    METAVAR = "(int > 0)"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> int:
    +        """Validates that the given argument is a positive integer. n > 0.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Returns:
    +            int: validated positive integer
    +        """
    +        if int(arg) > 0:
    +            return int(arg)
    +        else:
    +            raise argparse.ArgumentTypeError(f"invalid value: '{arg}' is not > 0.")
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a positive integer. n > 0.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    int + int + +
    +

    validated positive integer

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    @staticmethod
    +def type_parser(arg: str) -> int:
    +    """Validates that the given argument is a positive integer. n > 0.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Returns:
    +        int: validated positive integer
    +    """
    +    if int(arg) > 0:
    +        return int(arg)
    +    else:
    +        raise argparse.ArgumentTypeError(f"invalid value: '{arg}' is not > 0.")
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + Ratio + + +

    + + +
    + + +

    Validates that the given argument is a valid float value between zero and one.

    +

    0 <= float(n) <= 1

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is not in range.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class Ratio:
    +    """Validates that the given argument is a valid float value between zero and one.
    +
    +    0 <= float(n) <= 1
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is not in range.
    +    """
    +
    +    METAVAR = "(0 <= float(n) <= 1)"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> float:
    +        """Validates that the given argument is a valid float value between zero and one.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Raises:
    +            argparse.ArgumentTypeError: Value is not in range.
    +
    +        Returns:
    +            float: validated float value
    +        """
    +        if 0 <= float(arg) <= 1:
    +            return float(arg)
    +        else:
    +            raise argparse.ArgumentTypeError(f"invalid value: '{arg}' is not a float >= 0 and <= 1. Example: 0.5")
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a valid float value between zero and one.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is not in range.

    +
    +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    validated float value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    @staticmethod
    +def type_parser(arg: str) -> float:
    +    """Validates that the given argument is a valid float value between zero and one.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is not in range.
    +
    +    Returns:
    +        float: validated float value
    +    """
    +    if 0 <= float(arg) <= 1:
    +        return float(arg)
    +    else:
    +        raise argparse.ArgumentTypeError(f"invalid value: '{arg}' is not a float >= 0 and <= 1. Example: 0.5")
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + Symbol + + +

    + + +
    + + +

    Argument type for single ASCII/UTF-8 characters.

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is not a valid symbol.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class Symbol:
    +    """Argument type for single ASCII/UTF-8 characters.
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is not a valid symbol.
    +    """
    +
    +    METAVAR = "(ASCII/UTF-8 character)"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> str:
    +        """Validates that the given argument is a valid symbol.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Returns:
    +            str: validated symbol
    +        """
    +        if len(arg) == 1 and is_ascii_or_utf8(arg):
    +            return arg
    +        else:
    +            raise argparse.ArgumentTypeError(
    +                f"invalid symbol: '{arg}' is not a valid symbol. Must be a single ASCII/UTF-8 character."
    +            )
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a valid symbol.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    validated symbol

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    @staticmethod
    +def type_parser(arg: str) -> str:
    +    """Validates that the given argument is a valid symbol.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Returns:
    +        str: validated symbol
    +    """
    +    if len(arg) == 1 and is_ascii_or_utf8(arg):
    +        return arg
    +    else:
    +        raise argparse.ArgumentTypeError(
    +            f"invalid symbol: '{arg}' is not a valid symbol. Must be a single ASCII/UTF-8 character."
    +        )
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + +
    + + + +

    + TerminalDimensions + + +

    + + +
    + + +

    Argument type for terminal dimensions.

    +

    Terminal dimensions are a pair of non-negative integers separated by a space. Ex: 80 24

    + + + +

    Raises:

    + + + + + + + + + + + + + +
    TypeDescription
    + ArgumentTypeError + +
    +

    Value is not a valid terminal dimension.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    class TerminalDimensions:
    +    """Argument type for terminal dimensions.
    +
    +    Terminal dimensions are a pair of non-negative integers separated by a space. Ex: 80 24
    +
    +    Raises:
    +        argparse.ArgumentTypeError: Value is not a valid terminal dimension.
    +    """
    +
    +    METAVAR = "(width height)"
    +
    +    @staticmethod
    +    def type_parser(arg: str) -> int:
    +        """Validates that the given argument is a valid terminal dimension.
    +
    +        Args:
    +            arg (str): argument to validate
    +
    +        Returns:
    +            tuple[int,int]: validated terminal dimension
    +        """
    +        try:
    +            dimension = int(arg)
    +            if dimension < 0:
    +                raise argparse.ArgumentTypeError(
    +                    f"invalid terminal dimensions: '{arg}' is not a valid terminal dimension. Must be >= 0."
    +                )
    +            return dimension
    +        except ValueError:
    +            raise argparse.ArgumentTypeError(
    +                f"invalid terminal dimensions: '{arg}' is not a valid terminal dimension. Must be >= 0."
    +            )
    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + type_parser(arg) + + + staticmethod + + +

    + + +
    + +

    Validates that the given argument is a valid terminal dimension.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    arg + str + +
    +

    argument to validate

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + int + +
    +

    tuple[int,int]: validated terminal dimension

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    @staticmethod
    +def type_parser(arg: str) -> int:
    +    """Validates that the given argument is a valid terminal dimension.
    +
    +    Args:
    +        arg (str): argument to validate
    +
    +    Returns:
    +        tuple[int,int]: validated terminal dimension
    +    """
    +    try:
    +        dimension = int(arg)
    +        if dimension < 0:
    +            raise argparse.ArgumentTypeError(
    +                f"invalid terminal dimensions: '{arg}' is not a valid terminal dimension. Must be >= 0."
    +            )
    +        return dimension
    +    except ValueError:
    +        raise argparse.ArgumentTypeError(
    +            f"invalid terminal dimensions: '{arg}' is not a valid terminal dimension. Must be >= 0."
    +        )
    +
    +
    +
    + +
    + + + +
    + +
    + + +
    + + + +
    + + + +

    + is_ascii_or_utf8(s) + +

    + + +
    + +

    Tests if the given string is either ASCII or UTF-8.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    s + str + +
    +

    string to test

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    bool + bool + +
    +

    True if the string is either ASCII or UTF-8, False otherwise

    +
    +
    + +
    + Source code in terminaltexteffects/utils/argvalidators.py +
    def is_ascii_or_utf8(s: str) -> bool:
    +    """Tests if the given string is either ASCII or UTF-8.
    +
    +    Args:
    +        s (str): string to test
    +
    +    Returns:
    +        bool: True if the string is either ASCII or UTF-8, False otherwise
    +    """
    +    try:
    +        s.encode("ascii")
    +    except UnicodeEncodeError:
    +        try:
    +            s.encode("utf-8")
    +        except UnicodeEncodeError:
    +            return False
    +        else:
    +            return True
    +    else:
    +        return True
    +
    +
    +
    + +
    + + + +
    + +
    + +

    Example Usage

    +

    The following example demonstrates using the PositiveFloat class to provide a type_parser and metavar to the RandomSequenceConfig.speed argument. This will validate that the argument passed as --speed is a float > 0.

    +
    class RandomSequenceConfig(ArgsDataClass):
    +    speed: float = ArgField(
    +        cmd_name=["--speed"],
    +        type_parser=argvalidators.PositiveFloat.type_parser,
    +        default=0.004,
    +        metavar=argvalidators.PositiveFloat.METAVAR,
    +        help="Speed of the animation as a percentage of the total number of characters to reveal in each tick.",
    +    )  # type: ignore[assignment]
    +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/utils/colorterm/index.html b/engine/utils/colorterm/index.html new file mode 100755 index 00000000..d6c3c1b4 --- /dev/null +++ b/engine/utils/colorterm/index.html @@ -0,0 +1,2041 @@ + + + + + + + + + + + + + + + + + + + + + + + ColorTerm - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    ColorTerm

    +

    Module: terminaltexteffects.utils.colorterm

    + + +
    + + + + +
    + +

    This module converts xterm color codes and hex colors into ANSI escape sequences.

    + + + +
    + + + + + + + + + + +
    + + + +

    + bg(color_code) + +

    + + +
    + +

    Sets the background color of the terminal text.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    color_code + str | int + +
    +

    The value to set the background color, as a hex string or X-Term 256 color code.

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    The ANSI escape sequence to set the background color.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/colorterm.py +
    62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    def bg(color_code: str | int) -> str:
    +    """
    +    Sets the background color of the terminal text.
    +
    +    Args:
    +        color_code (str | int): The value to set the background color, as a hex string or X-Term 256 color code.
    +
    +    Returns:
    +        str: The ANSI escape sequence to set the background color.
    +
    +    """
    +    sequence = _color(color_code, 48)
    +    return sequence
    +
    +
    +
    + +
    + + +
    + + + +

    + fg(color_code) + +

    + + +
    + +

    Sets the foreground color of the terminal text.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    color_code + str | int + +
    +

    The value to set the foreground color, as a hex string or X-Term 256 color code.

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    str + str + +
    +

    The ANSI escape sequence to set the foreground color.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/colorterm.py +
    47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    def fg(color_code: str | int) -> str:
    +    """
    +    Sets the foreground color of the terminal text.
    +
    +    Args:
    +        color_code (str | int): The value to set the foreground color, as a hex string or X-Term 256 color code.
    +
    +    Returns:
    +        str: The ANSI escape sequence to set the foreground color.
    +
    +    """
    +    sequence = _color(color_code, 38)
    +    return sequence
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/utils/easing/index.html b/engine/utils/easing/index.html new file mode 100755 index 00000000..b9585cdd --- /dev/null +++ b/engine/utils/easing/index.html @@ -0,0 +1,5707 @@ + + + + + + + + + + + + + + + + + + + + + + + Easing Functions - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + + + + + +
    +
    + + + + +

    Easing Functions

    +

    Module: terminaltexteffects.utils.easing

    + + +
    + + + + +
    + +

    This module contains functions for easing calculations.

    + + + +

    Functions:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameDescription
    in_sine +
    +

    Ease in using a sine function.

    +
    +
    out_sine +
    +

    Ease out using a sine function.

    +
    +
    in_out_sine +
    +

    Ease in/out using a sine function.

    +
    +
    in_quad +
    +

    Ease in using a quadratic function.

    +
    +
    out_quad +
    +

    Ease out using a quadratic function.

    +
    +
    in_out_quad +
    +

    Ease in/out using a quadratic function.

    +
    +
    in_cubic +
    +

    Ease in using a cubic function.

    +
    +
    out_cubic +
    +

    Ease out using a cubic function.

    +
    +
    in_out_cubic +
    +

    Ease in/out using a cubic function.

    +
    +
    in_quart +
    +

    Ease in using a quartic function.

    +
    +
    out_quart +
    +

    Ease out using a quartic function.

    +
    +
    in_out_quart +
    +

    Ease in/out using a quartic function.

    +
    +
    in_quint +
    +

    Ease in using a quintic function.

    +
    +
    out_quint +
    +

    Ease out using a quintic function.

    +
    +
    in_out_quint +
    +

    Ease in/out using a quintic function.

    +
    +
    in_expo +
    +

    Ease in using an exponential function.

    +
    +
    out_expo +
    +

    Ease out using an exponential function.

    +
    +
    in_out_expo +
    +

    Ease in/out using an exponential function.

    +
    +
    in_circ +
    +

    Ease in using a circular function.

    +
    +
    out_circ +
    +

    Ease out using a circular function.

    +
    +
    in_out_circ +
    +

    Ease in/out using a circular function.

    +
    +
    in_back +
    +

    Ease in using a back function.

    +
    +
    out_back +
    +

    Ease out using a back function.

    +
    +
    in_out_back +
    +

    Ease in/out using a back function.

    +
    +
    in_elastic +
    +

    Ease in using an elastic function.

    +
    +
    out_elastic +
    +

    Ease out using an elastic function.

    +
    +
    in_out_elastic +
    +

    Ease in/out using an elastic function.

    +
    +
    in_bounce +
    +

    Ease in using a bounce function.

    +
    +
    out_bounce +
    +

    Ease out using a bounce function.

    +
    +
    in_out_bounce +
    +

    Ease in/out using a bounce function.

    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + in_back(progress_ratio) + +

    + + +
    + +

    Ease in using a back function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_back(progress_ratio: float) -> float:
    +    """
    +    Ease in using a back function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    c1 = 1.70158
    +    c3 = c1 + 1
    +    return c3 * progress_ratio**3 - c1 * progress_ratio**2
    +
    +
    +
    + +
    + + +
    + + + +

    + in_bounce(progress_ratio) + +

    + + +
    + +

    Ease in using a bounce function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 representing the percentage of the current waypoint speed to apply to the character

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_bounce(progress_ratio: float) -> float:
    +    """
    +    Ease in using a bounce function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 representing the percentage of the current waypoint speed to apply to the character
    +    """
    +    return 1 - out_bounce(1 - progress_ratio)
    +
    +
    +
    + +
    + + +
    + + + +

    + in_circ(progress_ratio) + +

    + + +
    + +

    Ease in using a circular function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_circ(progress_ratio: float) -> float:
    +    """
    +    Ease in using a circular function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    return 1 - math.sqrt(1 - progress_ratio**2)
    +
    +
    +
    + +
    + + +
    + + + +

    + in_cubic(progress_ratio) + +

    + + +
    + +

    Ease in using a cubic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_cubic(progress_ratio: float) -> float:
    +    """
    +    Ease in using a cubic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    return progress_ratio**3
    +
    +
    +
    + +
    + + +
    + + + +

    + in_elastic(progress_ratio) + +

    + + +
    + +

    Ease in using an elastic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_elastic(progress_ratio: float) -> float:
    +    """
    +    Ease in using an elastic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +
    +    c4 = (2 * math.pi) / 3
    +    if progress_ratio == 0:
    +        return 0
    +    elif progress_ratio == 1:
    +        return 1
    +    else:
    +        return -(2 ** (10 * progress_ratio - 10)) * math.sin((progress_ratio * 10 - 10.75) * c4)
    +
    +
    +
    + +
    + + +
    + + + +

    + in_expo(progress_ratio) + +

    + + +
    + +

    Ease in using an exponential function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_expo(progress_ratio: float) -> float:
    +    """
    +    Ease in using an exponential function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    if progress_ratio == 0:
    +        return 0
    +    else:
    +        return 2 ** (10 * progress_ratio - 10)
    +
    +
    +
    + +
    + + +
    + + + +

    + in_out_back(progress_ratio) + +

    + + +
    + +

    Ease in/out using a back function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_out_back(progress_ratio: float) -> float:
    +    """
    +    Ease in/out using a back function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    c1 = 1.70158
    +    c2 = c1 * 1.525
    +    if progress_ratio < 0.5:
    +        return ((2 * progress_ratio) ** 2 * ((c2 + 1) * 2 * progress_ratio - c2)) / 2
    +    else:
    +        return ((2 * progress_ratio - 2) ** 2 * ((c2 + 1) * (progress_ratio * 2 - 2) + c2) + 2) / 2
    +
    +
    +
    + +
    + + +
    + + + +

    + in_out_bounce(progress_ratio) + +

    + + +
    + +

    Ease in/out using a bounce function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_out_bounce(progress_ratio: float) -> float:
    +    """
    +    Ease in/out using a bounce function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    if progress_ratio < 0.5:
    +        return (1 - out_bounce(1 - 2 * progress_ratio)) / 2
    +    else:
    +        return (1 + out_bounce(2 * progress_ratio - 1)) / 2
    +
    +
    +
    + +
    + + +
    + + + +

    + in_out_circ(progress_ratio) + +

    + + +
    + +

    Ease in/out using a circular function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_out_circ(progress_ratio: float) -> float:
    +    """
    +    Ease in/out using a circular function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    if progress_ratio < 0.5:
    +        return (1 - math.sqrt(1 - (2 * progress_ratio) ** 2)) / 2
    +    else:
    +        return (math.sqrt(1 - (-2 * progress_ratio + 2) ** 2) + 1) / 2
    +
    +
    +
    + +
    + + +
    + + + +

    + in_out_cubic(progress_ratio) + +

    + + +
    + +

    Ease in/out using a cubic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 representing the percentage of the current waypoint speed to apply to the

    +
    +
    + float + +
    +

    character

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_out_cubic(progress_ratio: float) -> float:
    +    """
    +    Ease in/out using a cubic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 representing the percentage of the current waypoint speed to apply to the
    +        character
    +    """
    +    if progress_ratio < 0.5:
    +        return 4 * progress_ratio**3
    +    else:
    +        return 1 - (-2 * progress_ratio + 2) ** 3 / 2
    +
    +
    +
    + +
    + + +
    + + + +

    + in_out_elastic(progress_ratio) + +

    + + +
    + +

    Ease in/out using an elastic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 representing the percentage of the current waypoint speed to apply to the character

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_out_elastic(progress_ratio: float) -> float:
    +    """
    +    Ease in/out using an elastic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 representing the percentage of the current waypoint speed to apply to the character
    +    """
    +    c5 = (2 * math.pi) / 4.5
    +    if progress_ratio == 0:
    +        return 0
    +    elif progress_ratio == 1:
    +        return 1
    +    elif progress_ratio < 0.5:
    +        return -(2 ** (20 * progress_ratio - 10) * math.sin((20 * progress_ratio - 11.125) * c5)) / 2
    +    else:
    +        return (2 ** (-20 * progress_ratio + 10) * math.sin((20 * progress_ratio - 11.125) * c5)) / 2 + 1
    +
    +
    +
    + +
    + + +
    + + + +

    + in_out_expo(progress_ratio) + +

    + + +
    + +

    Ease in/out using an exponential function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_out_expo(progress_ratio: float) -> float:
    +    """
    +    Ease in/out using an exponential function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    if progress_ratio == 0:
    +        return 0
    +    elif progress_ratio == 1:
    +        return 1
    +    elif progress_ratio < 0.5:
    +        return 2 ** (20 * progress_ratio - 10) / 2
    +    else:
    +        return (2 - 2 ** (-20 * progress_ratio + 10)) / 2
    +
    +
    +
    + +
    + + +
    + + + +

    + in_out_quad(progress_ratio) + +

    + + +
    + +

    Ease in/out using a quadratic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_out_quad(progress_ratio: float) -> float:
    +    """
    +    Ease in/out using a quadratic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +
    +    """
    +    if progress_ratio < 0.5:
    +        return 2 * progress_ratio**2
    +    else:
    +        return 1 - (-2 * progress_ratio + 2) ** 2 / 2
    +
    +
    +
    + +
    + + +
    + + + +

    + in_out_quart(progress_ratio) + +

    + + +
    + +

    Ease in/out using a quartic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_out_quart(progress_ratio: float) -> float:
    +    """
    +    Ease in/out using a quartic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    if progress_ratio < 0.5:
    +        return 8 * progress_ratio**4
    +    else:
    +        return 1 - (-2 * progress_ratio + 2) ** 4 / 2
    +
    +
    +
    + +
    + + +
    + + + +

    + in_out_quint(progress_ratio) + +

    + + +
    + +

    Ease in/out using a quintic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_out_quint(progress_ratio: float) -> float:
    +    """
    +    Ease in/out using a quintic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    if progress_ratio < 0.5:
    +        return 16 * progress_ratio**5
    +    else:
    +        return 1 - (-2 * progress_ratio + 2) ** 5 / 2
    +
    +
    +
    + +
    + + +
    + + + +

    + in_out_sine(progress_ratio) + +

    + + +
    + +

    Ease in/out using a sine function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    def in_out_sine(progress_ratio: float) -> float:
    +    """
    +    Ease in/out using a sine function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +
    +    return -(math.cos(math.pi * progress_ratio) - 1) / 2
    +
    +
    +
    + +
    + + +
    + + + +

    + in_quad(progress_ratio) + +

    + + +
    + +

    Ease in using a quadratic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    def in_quad(progress_ratio: float) -> float:
    +    """
    +    Ease in using a quadratic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +
    +    return progress_ratio**2
    +
    +
    +
    + +
    + + +
    + + + +

    + in_quart(progress_ratio) + +

    + + +
    + +

    Ease in using a quartic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 representing the percentage

    +
    +
    + float + +
    +

    of the current waypoint speed to apply to the character

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_quart(progress_ratio: float) -> float:
    +    """
    +    Ease in using a quartic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 representing the percentage
    +        of the current waypoint speed to apply to the character
    +    """
    +    return progress_ratio**4
    +
    +
    +
    + +
    + + +
    + + + +

    + in_quint(progress_ratio) + +

    + + +
    + +

    Ease in using a quintic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def in_quint(progress_ratio: float) -> float:
    +    """
    +    Ease in using a quintic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    return progress_ratio**5
    +
    +
    +
    + +
    + + +
    + + + +

    + in_sine(progress_ratio) + +

    + + +
    + +

    Ease in using a sine function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    def in_sine(progress_ratio: float) -> float:
    +    """
    +    Ease in using a sine function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    return 1 - math.cos((progress_ratio * math.pi) / 2)
    +
    +
    +
    + +
    + + +
    + + + +

    + out_back(progress_ratio) + +

    + + +
    + +

    Ease out using a back function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def out_back(progress_ratio: float) -> float:
    +    """
    +    Ease out using a back function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    c1 = 1.70158
    +    c3 = c1 + 1
    +    return 1 + c3 * (progress_ratio - 1) ** 3 + c1 * (progress_ratio - 1) ** 2
    +
    +
    +
    + +
    + + +
    + + + +

    + out_bounce(progress_ratio) + +

    + + +
    + +

    Ease out using a bounce function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def out_bounce(progress_ratio: float) -> float:
    +    """
    +    Ease out using a bounce function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    n1 = 7.5625
    +    d1 = 2.75
    +    if progress_ratio < 1 / d1:
    +        return n1 * progress_ratio**2
    +    elif progress_ratio < 2 / d1:
    +        return n1 * (progress_ratio - 1.5 / d1) ** 2 + 0.75
    +    elif progress_ratio < 2.5 / d1:
    +        return n1 * (progress_ratio - 2.25 / d1) ** 2 + 0.9375
    +    else:
    +        return n1 * (progress_ratio - 2.625 / d1) ** 2 + 0.984375
    +
    +
    +
    + +
    + + +
    + + + +

    + out_circ(progress_ratio) + +

    + + +
    + +

    Ease out using a circular function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def out_circ(progress_ratio: float) -> float:
    +    """
    +    Ease out using a circular function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    return math.sqrt(1 - (progress_ratio - 1) ** 2)
    +
    +
    +
    + +
    + + +
    + + + +

    + out_cubic(progress_ratio) + +

    + + +
    + +

    Ease out using a cubic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def out_cubic(progress_ratio: float) -> float:
    +    """
    +    Ease out using a cubic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    return 1 - (1 - progress_ratio) ** 3
    +
    +
    +
    + +
    + + +
    + + + +

    + out_elastic(progress_ratio) + +

    + + +
    + +

    Ease out using an elastic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 representing the percentage of the current waypoint speed to apply to the character

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def out_elastic(progress_ratio: float) -> float:
    +    """
    +    Ease out using an elastic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 representing the percentage of the current waypoint speed to apply to the character
    +    """
    +    c4 = (2 * math.pi) / 3
    +    if progress_ratio == 0:
    +        return 0
    +    elif progress_ratio == 1:
    +        return 1
    +    else:
    +        return 2 ** (-10 * progress_ratio) * math.sin((progress_ratio * 10 - 0.75) * c4) + 1
    +
    +
    +
    + +
    + + +
    + + + +

    + out_expo(progress_ratio) + +

    + + +
    + +

    Ease out using an exponential function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def out_expo(progress_ratio: float) -> float:
    +    """
    +    Ease out using an exponential function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    if progress_ratio == 1:
    +        return 1
    +    else:
    +        return 1 - 2 ** (-10 * progress_ratio)
    +
    +
    +
    + +
    + + +
    + + + +

    + out_quad(progress_ratio) + +

    + + +
    + +

    Ease out using a quadratic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def out_quad(progress_ratio: float) -> float:
    +    """
    +    Ease out using a quadratic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +
    +    """
    +    return 1 - (1 - progress_ratio) * (1 - progress_ratio)
    +
    +
    +
    + +
    + + +
    + + + +

    + out_quart(progress_ratio) + +

    + + +
    + +

    Ease out using a quartic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def out_quart(progress_ratio: float) -> float:
    +    """
    +    Ease out using a quartic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    return 1 - (1 - progress_ratio) ** 4
    +
    +
    +
    + +
    + + +
    + + + +

    + out_quint(progress_ratio) + +

    + + +
    + +

    Ease out using a quintic function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    def out_quint(progress_ratio: float) -> float:
    +    """
    +    Ease out using a quintic function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    return 1 - (1 - progress_ratio) ** 5
    +
    +
    +
    + +
    + + +
    + + + +

    + out_sine(progress_ratio) + +

    + + +
    + +

    Ease out using a sine function.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    progress_ratio + float + +
    +

    the ratio of the current step to the maximum steps

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    0 <= n <= 1 eased value

    +
    +
    + +
    + Source code in terminaltexteffects/utils/easing.py +
    55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    def out_sine(progress_ratio: float) -> float:
    +    """
    +    Ease out using a sine function.
    +
    +    Args:
    +        progress_ratio (float): the ratio of the current step to the maximum steps
    +
    +    Returns:
    +        float: 0 <= n <= 1 eased value
    +    """
    +    return math.sin((progress_ratio * math.pi) / 2)
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/utils/geometry/index.html b/engine/utils/geometry/index.html new file mode 100755 index 00000000..55ac6940 --- /dev/null +++ b/engine/utils/geometry/index.html @@ -0,0 +1,3532 @@ + + + + + + + + + + + + + + + + + + + + + + + Geometry - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + + + + + +
    +
    + + + + +

    Geometry

    +

    Module: terminaltexteffects.utils.geometry

    + + +
    + + + + +
    + +

    This module provides utility functions for geometric calculations and operations.

    +

    The purpose of these functions is to find terminal coordinates that fall within certain regions or along certain paths. These functions are +used by effects to enable more complex animations and movement paths.

    + + + +

    Functions:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameDescription
    find_coords_on_circle +
    +

    Finds points on a circle given the origin, radius, and number of points.

    +
    +
    find_coords_in_circle +
    +

    Finds coordinates within an ellipse given the center and major axis length.

    +
    +
    find_coords_in_rect +
    +

    Finds coordinates within a rectangle given the origin and distance.

    +
    +
    find_coord_at_distance +
    +

    Finds the coordinate at a given distance along a line defined by two coordinates.

    +
    +
    find_coord_on_bezier_curve +
    +

    Finds points on a quadratic or cubic bezier curve.

    +
    +
    find_coord_on_line +
    +

    Finds points on a line.

    +
    +
    find_length_of_bezier_curve +
    +

    Finds the length of a quadratic or cubic bezier curve.

    +
    +
    find_length_of_line +
    +

    Finds the length of a line intersecting two coordinates.

    +
    +
    find_normalized_distance_from_center +
    +

    Returns the normalized distance from the center of the OutputArea.

    +
    +
    + + + +
    + + + + + + + + +
    + + + +

    + Coord + + + + dataclass + + +

    + + +
    + + +

    A coordinate with row and column values.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    column + int + +
    +

    column value

    +
    +
    + required +
    row + int + +
    +

    row value

    +
    +
    + required +
    + +
    + Source code in terminaltexteffects/utils/geometry.py +
    23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    @dataclass(eq=True, frozen=True)
    +class Coord:
    +    """A coordinate with row and column values.
    +
    +    Args:
    +        column (int): column value
    +        row (int): row value"""
    +
    +    column: int
    +    row: int
    +
    +
    + + + +
    + + + + + + + + + + + +
    + +
    + + +
    + + + +
    + + + +

    + find_coord_at_distance(origin, target, distance) + +

    + + +
    + +

    Finds the coordinate at the given distance along the line defined by the origin and target coordinates.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    origin + Coord + +
    +

    origin coordinate (a)

    +
    +
    + required +
    target + Coord + +
    +

    target coordinate (b)

    +
    +
    + required +
    distance + float + +
    +

    distance from the target coordinate (b), away from the origin coordinate (a)

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Coord + Coord + +
    +

    Coordinate at the given distance (c).

    +
    +
    + +
    + Source code in terminaltexteffects/utils/geometry.py +
    def find_coord_at_distance(origin: Coord, target: Coord, distance: float) -> Coord:
    +    """Finds the coordinate at the given distance along the line defined by the origin and target coordinates.
    +
    +    Args:
    +        origin (Coord): origin coordinate (a)
    +        target (Coord): target coordinate (b)
    +        distance (float): distance from the target coordinate (b), away from the origin coordinate (a)
    +
    +    Returns:
    +        Coord: Coordinate at the given distance (c).
    +    """
    +    total_distance = find_length_of_line(origin, target) + distance
    +    if total_distance == 0 or origin == target:
    +        return origin
    +    t = total_distance / find_length_of_line(origin, target)
    +    next_column, next_row = (
    +        ((1 - t) * origin.column + t * target.column),
    +        ((1 - t) * origin.row + t * target.row),
    +    )
    +    return Coord(round(next_column), round(next_row))
    +
    +
    +
    + +
    + + +
    + + + +

    + find_coord_on_bezier_curve(start, control, end, t) + +

    + + +
    + +

    Finds points on a quadratic or cubic bezier curve.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    start + Coord + +
    +

    The starting coordinate of the curve.

    +
    +
    + required +
    control + tuple[Coord, ...] | Coord + +
    +

    The control point(s) of the curve. +For a quadratic bezier curve, a single control point is expected. +For a cubic bezier curve, two control points are expected.

    +
    +
    + required +
    end + Coord + +
    +

    The ending coordinate of the curve.

    +
    +
    + required +
    t + float + +
    +

    The parameter value between 0 and 1 that determines the position on the curve.

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Coord + Coord + +
    +

    The coordinate on the bezier curve corresponding to the given parameter value.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/geometry.py +
    def find_coord_on_bezier_curve(start: Coord, control: tuple[Coord, ...] | Coord, end: Coord, t: float) -> Coord:
    +    """
    +    Finds points on a quadratic or cubic bezier curve.
    +
    +    Args:
    +        start (Coord): The starting coordinate of the curve.
    +        control (tuple[Coord, ...] | Coord): The control point(s) of the curve.
    +            For a quadratic bezier curve, a single control point is expected.
    +            For a cubic bezier curve, two control points are expected.
    +        end (Coord): The ending coordinate of the curve.
    +        t (float): The parameter value between 0 and 1 that determines the position on the curve.
    +
    +    Returns:
    +        Coord: The coordinate on the bezier curve corresponding to the given parameter value.
    +    """
    +    if isinstance(control, Coord):
    +        control = (control,)
    +    if len(control) == 1:
    +        control1 = control[0]
    +        x = (1 - t) ** 2 * start.column + 2 * (1 - t) * t * control1.column + t**2 * end.column
    +        y = (1 - t) ** 2 * start.row + 2 * (1 - t) * t * control1.row + t**2 * end.row
    +    elif len(control) == 2:
    +        control1, control2 = control
    +        x = (
    +            (1 - t) ** 3 * start.column
    +            + 3 * (1 - t) ** 2 * t * control1.column
    +            + 3 * (1 - t) * t**2 * control2.column
    +            + t**3 * end.column
    +        )
    +        y = (
    +            (1 - t) ** 3 * start.row
    +            + 3 * (1 - t) ** 2 * t * control1.row
    +            + 3 * (1 - t) * t**2 * control2.row
    +            + t**3 * end.row
    +        )
    +    return Coord(round(x), round(y))
    +
    +
    +
    + +
    + + +
    + + + +

    + find_coord_on_line(start, end, t) + +

    + + +
    + +

    Finds points on a line.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    start + Coord + +
    +

    The starting coordinate of the line.

    +
    +
    + required +
    end + Coord + +
    +

    The ending coordinate of the line.

    +
    +
    + required +
    t + float + +
    +

    The parameter value between 0 and 1 representing the position on the line.

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    Coord + Coord + +
    +

    The coordinate on the line corresponding to the given parameter value.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/geometry.py +
    def find_coord_on_line(start: Coord, end: Coord, t: float) -> Coord:
    +    """
    +    Finds points on a line.
    +
    +    Args:
    +        start (Coord): The starting coordinate of the line.
    +        end (Coord): The ending coordinate of the line.
    +        t (float): The parameter value between 0 and 1 representing the position on the line.
    +
    +    Returns:
    +        Coord: The coordinate on the line corresponding to the given parameter value.
    +    """
    +    x = (1 - t) * start.column + t * end.column
    +    y = (1 - t) * start.row + t * end.row
    +    return Coord(round(x), round(y))
    +
    +
    +
    + +
    + + +
    + + + +

    + find_coords_in_circle(center, diameter) + +

    + + +
    + +

    Find the coordinates within an circle given the center and diameter. The actual +shape calculated is an ellipse with a major axis of length diameter, however the +terminal cell height/width ratio creates a circle visually.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    center + Coord + +
    +

    The center coordinate of the circle.

    +
    +
    + required +
    diameter + int + +
    +

    The length of the major axis of the circle.

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + list[Coord] + +
    +

    list[Coord]: A list of coordinates within the circle.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/geometry.py +
    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
    def find_coords_in_circle(center: Coord, diameter: int) -> list[Coord]:
    +    """
    +    Find the coordinates within an circle given the center and diameter. The actual
    +    shape calculated is an ellipse with a major axis of length diameter, however the
    +    terminal cell height/width ratio creates a circle visually.
    +
    +    Args:
    +        center (Coord): The center coordinate of the circle.
    +        diameter (int): The length of the major axis of the circle.
    +
    +    Returns:
    +        list[Coord]: A list of coordinates within the circle.
    +    """
    +
    +    h, k = center.column, center.row
    +    coords_in_ellipse: list[Coord] = []
    +    a_squared = diameter**2
    +    b_squared = (diameter / 2) ** 2
    +
    +    for x in range(h - diameter, h + diameter + 1):
    +        for y in range(k - diameter, k + diameter + 1):
    +            if (x - h) ** 2 / a_squared + (y - k) ** 2 / b_squared <= 1:
    +                coords_in_ellipse.append(Coord(x, y))
    +
    +    return coords_in_ellipse
    +
    +
    +
    + +
    + + +
    + + + +

    + find_coords_in_rect(origin, distance) + +

    + + +
    + +

    Find coords that fall within a rectangle with the given origin and distance +from the origin. Distance specifies the number of units in each direction from the origin. +Final width = 2 * distance + 1, final height = 2 * distance + 1.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    origin + Coord + +
    +

    center of the rectangle

    +
    +
    + required +
    distance + int + +
    +

    distance from the origin

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + list[Coord] + +
    +

    list[Coord]: list of Coord points in the rectangle

    +
    +
    + +
    + Source code in terminaltexteffects/utils/geometry.py +
    def find_coords_in_rect(origin: Coord, distance: int) -> list[Coord]:
    +    """Find coords that fall within a rectangle with the given origin and distance
    +    from the origin. Distance specifies the number of units in each direction from the origin.
    +    Final width = 2 * distance + 1, final height = 2 * distance + 1.
    +
    +    Args:
    +        origin (Coord): center of the rectangle
    +        distance (int): distance from the origin
    +
    +    Returns:
    +        list[Coord]: list of Coord points in the rectangle
    +    """
    +    left_boundary = origin.column - distance
    +    right_boundary = origin.column + distance
    +    top_boundary = origin.row - distance
    +    bottom_boundary = origin.row + distance
    +    coords: list[Coord] = []
    +    for column in range(left_boundary, right_boundary + 1):
    +        for row in range(top_boundary, bottom_boundary + 1):
    +            coords.append(Coord(column, row))
    +
    +    return coords
    +
    +
    +
    + +
    + + +
    + + + +

    + find_coords_on_circle(origin, radius, coords_limit=0, unique=True) + +

    + + +
    + +

    Finds points on a circle.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    origin + Coord + +
    +

    origin of the circle

    +
    +
    + required +
    radius + int + +
    +

    radius of the circle

    +
    +
    + required +
    coords_limit + int + +
    +

    limit the number of coords returned, if 0, the number of points is calculated based on the circumference of the circle

    +
    +
    + 0 +
    unique + bool + +
    +

    whether to remove duplicate points. Defaults to True.

    +
    +
    + True +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    list + Coord + +
    +

    list of Coord points on the circle

    +
    +
    + +
    + Source code in terminaltexteffects/utils/geometry.py +
    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
    def find_coords_on_circle(origin: Coord, radius: int, coords_limit: int = 0, unique: bool = True) -> list[Coord]:
    +    """Finds points on a circle.
    +
    +    Args:
    +        origin (Coord): origin of the circle
    +        radius (int): radius of the circle
    +        coords_limit (int): limit the number of coords returned, if 0, the number of points is calculated based on the circumference of the circle
    +        unique (bool): whether to remove duplicate points. Defaults to True.
    +
    +    Returns:
    +        list (Coord): list of Coord points on the circle
    +    """
    +    points = []
    +    if not coords_limit:
    +        coords_limit = round(2 * math.pi * radius)
    +    for i in range(coords_limit):
    +        angle = 2 * math.pi * i / coords_limit
    +        x = origin.column + radius * math.cos(angle)
    +        # correct for terminal character height/width ratio by doubling the x distance from origin
    +        x_diff = x - origin.column
    +        x += x_diff
    +        y = origin.row + radius * math.sin(angle)
    +        point_coord = Coord(round(x), round(y))
    +        if unique and point_coord not in points:
    +            points.append(point_coord)
    +        elif not unique:
    +            points.append(point_coord)
    +
    +    return points
    +
    +
    +
    + +
    + + +
    + + + +

    + find_length_of_bezier_curve(start, control, end) + +

    + + +
    + +

    Finds the length of a quadratic or cubic bezier curve.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    start + Coord + +
    +

    The starting coordinate of the curve.

    +
    +
    + required +
    control + tuple[Coord, ...] | Coord + +
    +

    The control point(s) of the curve.

    +
    +
    + required +
    end + Coord + +
    +

    The ending coordinate of the curve.

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    The length of the bezier curve.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/geometry.py +
    def find_length_of_bezier_curve(start: Coord, control: tuple[Coord, ...] | Coord, end: Coord) -> float:
    +    """
    +    Finds the length of a quadratic or cubic bezier curve.
    +
    +    Args:
    +        start (Coord): The starting coordinate of the curve.
    +        control (tuple[Coord, ...] | Coord): The control point(s) of the curve.
    +        end (Coord): The ending coordinate of the curve.
    +
    +    Returns:
    +        float: The length of the bezier curve.
    +    """
    +    length = 0.0
    +    prev_coord = start
    +    for t in range(1, 10):
    +        coord = find_coord_on_bezier_curve(start, control, end, t / 10)
    +        length += find_length_of_line(prev_coord, coord)
    +        prev_coord = coord
    +        prev_coord = coord
    +    return length
    +
    +
    +
    + +
    + + +
    + + + +

    + find_length_of_line(coord1, coord2, double_row_diff=False) + +

    + + +
    + +

    Returns the length of the line intersecting coord1 and coord2. If double_row_diff is True, the distance is +doubled to account for the terminal character height/width ratio.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    coord1 + Coord + +
    +

    first coordinate.

    +
    +
    + required +
    coord2 + Coord + +
    +

    second coordinate.

    +
    +
    + required +
    double_row_diff + bool + +
    +

    whether to double the row difference to account for terminal character height/width ratio. Defaults to False.

    +
    +
    + False +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    length of the line

    +
    +
    + +
    + Source code in terminaltexteffects/utils/geometry.py +
    def find_length_of_line(coord1: Coord, coord2: Coord, double_row_diff: bool = False) -> float:
    +    """Returns the length of the line intersecting coord1 and coord2. If double_row_diff is True, the distance is
    +    doubled to account for the terminal character height/width ratio.
    +
    +    Args:
    +        coord1 (Coord): first coordinate.
    +        coord2 (Coord): second coordinate.
    +        double_row_diff (bool, optional): whether to double the row difference to account for terminal character height/width ratio. Defaults to False.
    +
    +    Returns:
    +        float: length of the line
    +    """
    +    column_diff = coord2.column - coord1.column
    +    row_diff = coord2.row - coord1.row
    +    if double_row_diff:
    +        return math.hypot(column_diff, 2 * row_diff)
    +    return math.hypot(column_diff, row_diff)
    +
    +
    +
    + +
    + + +
    + + + +

    + find_normalized_distance_from_center(max_row, max_column, other_coord) + +

    + + +
    + +

    Returns the normalized distance from the center of the OutputArea as a float between 0 and 1.

    +

    The distance is calculated using the Pythagorean theorem and accounts for the aspect ratio of the terminal.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    max_row + int + +
    +

    Maximum row value of the OutputArea.

    +
    +
    + required +
    max_column + int + +
    +

    Maximum column value of the OutputArea.

    +
    +
    + required +
    other_coord + Coord + +
    +

    Other coordinate from which to calculate the distance.

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    float + float + +
    +

    Normalized distance from the center of the OutputArea, float between 0 and 1.

    +
    +
    + +
    + Source code in terminaltexteffects/utils/geometry.py +
    def find_normalized_distance_from_center(max_row: int, max_column: int, other_coord: Coord) -> float:
    +    """Returns the normalized distance from the center of the OutputArea as a float between 0 and 1.
    +
    +    The distance is calculated using the Pythagorean theorem and accounts for the aspect ratio of the terminal.
    +
    +    Args:
    +        max_row (int): Maximum row value of the OutputArea.
    +        max_column (int): Maximum column value of the OutputArea.
    +        other_coord (Coord): Other coordinate from which to calculate the distance.
    +
    +    Returns:
    +        float: Normalized distance from the center of the OutputArea, float between 0 and 1.
    +    """
    +    center_x = max_column / 2
    +    center_y = max_row / 2
    +
    +    max_distance = ((max_column**2) + ((max_row * 2) ** 2)) ** 0.5
    +
    +    distance = ((other_coord.column - center_x) ** 2 + (((other_coord.row) - center_y) * 2) ** 2) ** 0.5
    +
    +    return distance / (max_distance / 2)
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/engine/gradient/index.html b/engine/utils/gradient/index.html similarity index 84% rename from engine/gradient/index.html rename to engine/utils/gradient/index.html index 3236cdf9..81cf25ae 100755 --- a/engine/gradient/index.html +++ b/engine/utils/gradient/index.html @@ -9,13 +9,13 @@ - + - + - + @@ -24,10 +24,10 @@ - + - + @@ -46,9 +46,9 @@ - + - + @@ -88,7 +88,7 @@

    class Gradient:
    +212
    +213
    +214
    class Gradient:
         """A Gradient is a list of RGB hex color strings transitioning from one color to another. The gradient color
         list is calculated using linear interpolation based on the provided start and end colors and the number of steps. Gradients
         can be iterated over to get the next color in the gradient color list. If there is only one color in the stops list,
    @@ -1580,53 +2202,55 @@ 

    QuickStart

    ) -> dict[geometry.Coord, Color]: """Builds a mapping of coordinates to colors based on the gradient and a direction. - Args: - max_row (int): The maximum row value. - max_column (int): The maximum column value. - direction (Gradient.Direction): The direction of the gradient. - - Returns: - dict[Coord, str]: A mapping of coordinates to colors. - """ - gradient_mapping: dict[geometry.Coord, Color] = {} - if direction == Gradient.Direction.VERTICAL: - for row_value in range(max_row + 1): - fraction = row_value / max_row - color = self.get_color_at_fraction(fraction) - for column_value in range(1, max_column + 1): - gradient_mapping[geometry.Coord(column_value, row_value)] = color - elif direction == Gradient.Direction.HORIZONTAL: - for column_value in range(1, max_column + 1): - fraction = column_value / max_column - color = self.get_color_at_fraction(fraction) - for row_value in range(max_row + 1): - gradient_mapping[geometry.Coord(column_value, row_value)] = color - elif direction == Gradient.Direction.CENTER: - for row_value in range(max_row + 1): - for column_value in range(1, max_column + 1): - distance_from_center = geometry.find_normalized_distance_from_center( - max_row, max_column, geometry.Coord(column_value, row_value) - ) - color = self.get_color_at_fraction(distance_from_center) - gradient_mapping[geometry.Coord(column_value, row_value)] = color - elif direction == Gradient.Direction.DIAGONAL: - for row_value in range(max_row + 1): - for column_value in range(1, max_column + 1): - fraction = ((row_value * 2) + column_value) / ((max_row * 2) + max_column) - color = self.get_color_at_fraction(fraction) - gradient_mapping[geometry.Coord(column_value, row_value)] = color - - return gradient_mapping + For example, a vertical gradient will have the same color for each column in a row. When applied across all characters in the output area, the gradient will be visible as a vertical gradient. + + Args: + max_row (int): The maximum row value. + max_column (int): The maximum column value. + direction (Gradient.Direction): The direction of the gradient. + + Returns: + dict[Coord, str]: A mapping of coordinates to colors. + """ + gradient_mapping: dict[geometry.Coord, Color] = {} + if direction == Gradient.Direction.VERTICAL: + for row_value in range(max_row + 1): + fraction = row_value / max_row + color = self.get_color_at_fraction(fraction) + for column_value in range(1, max_column + 1): + gradient_mapping[geometry.Coord(column_value, row_value)] = color + elif direction == Gradient.Direction.HORIZONTAL: + for column_value in range(1, max_column + 1): + fraction = column_value / max_column + color = self.get_color_at_fraction(fraction) + for row_value in range(max_row + 1): + gradient_mapping[geometry.Coord(column_value, row_value)] = color + elif direction == Gradient.Direction.CENTER: + for row_value in range(max_row + 1): + for column_value in range(1, max_column + 1): + distance_from_center = geometry.find_normalized_distance_from_center( + max_row, max_column, geometry.Coord(column_value, row_value) + ) + color = self.get_color_at_fraction(distance_from_center) + gradient_mapping[geometry.Coord(column_value, row_value)] = color + elif direction == Gradient.Direction.DIAGONAL: + for row_value in range(max_row + 1): + for column_value in range(1, max_column + 1): + fraction = ((row_value * 2) + column_value) / ((max_row * 2) + max_column) + color = self.get_color_at_fraction(fraction) + gradient_mapping[geometry.Coord(column_value, row_value)] = color - def __iter__(self) -> Iterator[str]: - yield from self.spectrum - - def __len__(self) -> int: - return len(self.spectrum) - - def __str__(self) -> str: - color_blocks = [f"{colorterm.fg(color)}{colorterm.RESET}" for color in self.spectrum] - return f"Gradient: Stops({self._stops}), Steps({self._steps})\n" + "".join(color_blocks) + return gradient_mapping + + def __iter__(self) -> Iterator[str]: + yield from self.spectrum + + def __len__(self) -> int: + return len(self.spectrum) + + def __str__(self) -> str: + color_blocks = [f"{colorterm.fg(color)}{ansitools.RESET_ALL()}" for color in self.spectrum] + return f"Gradient: Stops({self._stops}), Steps({self._steps})\n" + "".join(color_blocks)
    @@ -1938,6 +2562,7 @@

    Builds a mapping of coordinates to colors based on the gradient and a direction.

    +

    For example, a vertical gradient will have the same color for each column in a row. When applied across all characters in the output area, the gradient will be visible as a vertical gradient.

    @@ -2010,7 +2635,7 @@

    - dict[Coord, Color] + dict[Coord, Color]
    @@ -2064,48 +2689,52 @@

    199 200 201 -202

    def build_coordinate_color_mapping(
    +202
    +203
    +204
    def build_coordinate_color_mapping(
         self, max_row: int, max_column: int, direction: "Gradient.Direction"
     ) -> dict[geometry.Coord, Color]:
         """Builds a mapping of coordinates to colors based on the gradient and a direction.
     
    -    Args:
    -        max_row (int): The maximum row value.
    -        max_column (int): The maximum column value.
    -        direction (Gradient.Direction): The direction of the gradient.
    -
    -    Returns:
    -        dict[Coord, str]: A mapping of coordinates to colors.
    -    """
    -    gradient_mapping: dict[geometry.Coord, Color] = {}
    -    if direction == Gradient.Direction.VERTICAL:
    -        for row_value in range(max_row + 1):
    -            fraction = row_value / max_row
    -            color = self.get_color_at_fraction(fraction)
    -            for column_value in range(1, max_column + 1):
    -                gradient_mapping[geometry.Coord(column_value, row_value)] = color
    -    elif direction == Gradient.Direction.HORIZONTAL:
    -        for column_value in range(1, max_column + 1):
    -            fraction = column_value / max_column
    -            color = self.get_color_at_fraction(fraction)
    -            for row_value in range(max_row + 1):
    -                gradient_mapping[geometry.Coord(column_value, row_value)] = color
    -    elif direction == Gradient.Direction.CENTER:
    -        for row_value in range(max_row + 1):
    -            for column_value in range(1, max_column + 1):
    -                distance_from_center = geometry.find_normalized_distance_from_center(
    -                    max_row, max_column, geometry.Coord(column_value, row_value)
    -                )
    -                color = self.get_color_at_fraction(distance_from_center)
    -                gradient_mapping[geometry.Coord(column_value, row_value)] = color
    -    elif direction == Gradient.Direction.DIAGONAL:
    -        for row_value in range(max_row + 1):
    -            for column_value in range(1, max_column + 1):
    -                fraction = ((row_value * 2) + column_value) / ((max_row * 2) + max_column)
    -                color = self.get_color_at_fraction(fraction)
    -                gradient_mapping[geometry.Coord(column_value, row_value)] = color
    -
    -    return gradient_mapping
    +    For example, a vertical gradient will have the same color for each column in a row. When applied across all characters in the output area, the gradient will be visible as a vertical gradient.
    +
    +    Args:
    +        max_row (int): The maximum row value.
    +        max_column (int): The maximum column value.
    +        direction (Gradient.Direction): The direction of the gradient.
    +
    +    Returns:
    +        dict[Coord, str]: A mapping of coordinates to colors.
    +    """
    +    gradient_mapping: dict[geometry.Coord, Color] = {}
    +    if direction == Gradient.Direction.VERTICAL:
    +        for row_value in range(max_row + 1):
    +            fraction = row_value / max_row
    +            color = self.get_color_at_fraction(fraction)
    +            for column_value in range(1, max_column + 1):
    +                gradient_mapping[geometry.Coord(column_value, row_value)] = color
    +    elif direction == Gradient.Direction.HORIZONTAL:
    +        for column_value in range(1, max_column + 1):
    +            fraction = column_value / max_column
    +            color = self.get_color_at_fraction(fraction)
    +            for row_value in range(max_row + 1):
    +                gradient_mapping[geometry.Coord(column_value, row_value)] = color
    +    elif direction == Gradient.Direction.CENTER:
    +        for row_value in range(max_row + 1):
    +            for column_value in range(1, max_column + 1):
    +                distance_from_center = geometry.find_normalized_distance_from_center(
    +                    max_row, max_column, geometry.Coord(column_value, row_value)
    +                )
    +                color = self.get_color_at_fraction(distance_from_center)
    +                gradient_mapping[geometry.Coord(column_value, row_value)] = color
    +    elif direction == Gradient.Direction.DIAGONAL:
    +        for row_value in range(max_row + 1):
    +            for column_value in range(1, max_column + 1):
    +                fraction = ((row_value * 2) + column_value) / ((max_row * 2) + max_column)
    +                color = self.get_color_at_fraction(fraction)
    +                gradient_mapping[geometry.Coord(column_value, row_value)] = color
    +
    +    return gradient_mapping
     

    @@ -2268,10 +2897,10 @@

    - + - + diff --git a/engine/utils/hexterm/index.html b/engine/utils/hexterm/index.html new file mode 100755 index 00000000..3bcf5f6f --- /dev/null +++ b/engine/utils/hexterm/index.html @@ -0,0 +1,2243 @@ + + + + + + + + + + + + + + + + + + + + + + + HexTerm - TerminalTextEffects Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    HexTerm

    +

    Module: terminaltexteffects.utils.hexterm

    + + +
    + + + + +
    + +

    This module contains a list of all XTerm-256 color codes and functions to convert between RGB Hex color strings and XTerm-256 color codes.

    + + + +

    Functions:

    + + + + + + + + + + + + + + + + + + + + + +
    NameDescription
    hex_to_xterm +
    +

    Convert RGB Hex colors to their closest XTerm-256 color.

    +
    +
    xterm_to_hex +
    +

    Convert XTerm-256 color codes to RGB Hex colors.

    +
    +
    is_valid_color +
    +

    Check if the input is a valid RGB Hex color code.

    +
    +
    + + + +
    + + + + + + + + + + +
    + + + +

    + hex_to_xterm(hex_color) + +

    + + +
    + +

    Convert RGB Hex colors to their closest XTerm-256 color.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    hex_color + str + +
    +

    RGB Hex color code, '#' is optional

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    int + int + +
    +

    (0-255) XTerm-256 color code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/hexterm.py +
    def hex_to_xterm(hex_color: str) -> int:
    +    """Convert RGB Hex colors to their closest XTerm-256 color.
    +
    +    Args:
    +        hex_color (str): RGB Hex color code, '#' is optional
    +
    +    Returns:
    +        int: (0-255) XTerm-256 color code
    +
    +    """
    +    color_string = hex_color.strip("#")
    +    closest = sorted(
    +        list(
    +            (
    +                xterm_color,
    +                sum(
    +                    [
    +                        abs(x[0] - x[1])
    +                        for x in zip(
    +                            [int(color_string[i : i + 2], 16) for i in range(0, 6, 2)],
    +                            [int(xterm_hex.strip("#")[i : i + 2], 16) for i in range(0, 6, 2)],
    +                        )
    +                    ]
    +                )
    +                / 3,
    +            )
    +            for xterm_color, xterm_hex in xterm_to_hex_map.items()
    +        ),
    +        key=lambda x_diff: x_diff[1],
    +    )[0][0]
    +    return closest
    +
    +
    +
    + +
    + + +
    + + + +

    + is_valid_color(color) + +

    + + +
    + +

    Check if the input is a valid RGB Hex color code.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    color + int | str + +
    +

    X-Term 256 color code or RGB Hex color code, '#' is optional

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    bool + bool + +
    +

    True if the input is a valid color code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/hexterm.py +
    def is_valid_color(color: int | str) -> bool:
    +    """Check if the input is a valid RGB Hex color code.
    +
    +    Args:
    +        color (int | str): X-Term 256 color code or RGB Hex color code, '#' is optional
    +
    +    Returns:
    +        bool: True if the input is a valid color code
    +
    +    """
    +    if isinstance(color, str):
    +        if len(color) not in [6, 7]:
    +            return False
    +        try:
    +            int(color.strip("#"), 16)
    +        except ValueError:
    +            return False
    +        return True
    +    else:
    +        return color in range(256)
    +
    +
    +
    + +
    + + +
    + + + +

    + xterm_to_hex(xterm_color) + +

    + + +
    + +

    Convert XTerm-256 color code to RGB Hex color code.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    xterm_color + int + +
    +

    (0-255) XTerm-256 color code

    +
    +
    + required +
    + + + +

    Returns:

    + + + + + + + + + + + + + +
    Name TypeDescription
    int + str + +
    +

    RGB Hex color code

    +
    +
    + +
    + Source code in terminaltexteffects/utils/hexterm.py +
    def xterm_to_hex(xterm_color: int) -> str:
    +    """Convert XTerm-256 color code to RGB Hex color code.
    +
    +    Args:
    +        xterm_color (int): (0-255) XTerm-256 color code
    +
    +    Returns:
    +        int: RGB Hex color code
    +    """
    +    return xterm_to_hex_map[xterm_color].strip("#")
    +
    +
    +
    + +
    + + + +
    + +
    + +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/explanation/index.html b/explanation/index.html index 58df7cce..eac1bb9f 100755 --- a/explanation/index.html +++ b/explanation/index.html @@ -9,7 +9,7 @@ - + @@ -230,6 +230,41 @@ + + + diff --git a/how-to-guides/index.html b/how-to-guides/index.html index 95641ddf..c54981bb 100755 --- a/how-to-guides/index.html +++ b/how-to-guides/index.html @@ -12,7 +12,7 @@ - + @@ -240,6 +240,41 @@ + + + diff --git a/index.html b/index.html index 3c462a61..9c35f36c 100755 --- a/index.html +++ b/index.html @@ -293,6 +293,41 @@ + + + diff --git a/objects.inv b/objects.inv index e7eb068e..a436aa2e 100755 Binary files a/objects.inv and b/objects.inv differ diff --git a/sitemap.xml.gz b/sitemap.xml.gz index aeafb32a..563e75dc 100755 Binary files a/sitemap.xml.gz and b/sitemap.xml.gz differ diff --git a/tutorials/index.html b/tutorials/index.html index 6e88c3ba..9f0b6d98 100755 --- a/tutorials/index.html +++ b/tutorials/index.html @@ -240,6 +240,41 @@ + + +