Skip to content

xnano.types

xnano.types

xnano.types

The types that describe what xnano accepts: positions and sizes as an axis, anything that can be added to a canvas, space around text, pixel encodings, the settings of a canvas and of the screen it is opened on, and the functions that hook into events.

Classes:

  • SpacingDictionary –

    Space around text, edge by edge.

  • EffectController –

    The effects of the hook that is running, one method for each effect.

  • PlayableEffects –

    The sound effects of a canvas's audio, one method for each effect.

  • RenderableEffects –

    The visual effects of a placement or a canvas, one method for each effect.

  • HookHandle –

    One hook attached to a canvas or a placement.

  • SupportsPlay –

    Anything that can be played: an object with a __xnano_play__ method.

  • SupportsRender –

    Anything that draws itself: an object with a __xnano_render__ method.

  • GateSettings –

    What a screen reports to a canvas: the input gates of new() and open().

  • CanvasAppearanceArguments –

    How a canvas itself looks: its colors, text modifiers, border, padding and margin.

  • AppearanceArguments –

    How written content looks: the appearance keywords of write.

  • CanvasSettings –

    The keyword settings of new: the input gates and the canvas's own look.

  • OpenSettings –

    The keyword settings of Canvas.open and of

  • PlayOptions –

    The keyword options of play. An option replaces the same value on a

Attributes:

Spacing module-attribute

Space around text: one value for every edge or a SpacingDictionary.

A whole number is a count of cells. A float (0.1) or a percentage string ('10%') is a share of the text's width for the left and right edges and of its height for the top and bottom edges, read when the spacing is applied.

EffectCustomization module-attribute

EffectCustomization = RenderableEffect | PlayableEffect

Any visual or sound effect, as the customization that fx(...) returns.

This is not Effect, the class whose methods build a visual effect for update.

PlayableEffect module-attribute

PlayableEffect = BitCrushAudioCustomization | DistortionAudioCustomization | LowPassAudioCustomization | HighPassAudioCustomization | DelayAudioCustomization | ReverbAudioCustomization | TremoloAudioCustomization

A sound effect as fx(...) and the methods of canvas.audio.fx and context.fx return it.

PlayableEffectKind module-attribute

PlayableEffectKind = Literal['audio.bit_crush', 'audio.distortion', 'audio.low_pass', 'audio.high_pass', 'audio.delay', 'audio.reverb', 'audio.tremolo']

The kinds of effect that change how a sound plays: fx kinds that start with 'audio.'.

PlayableEffectSpecification module-attribute

PlayableEffectSpecification = BitCrushAudioSpecification | DistortionAudioSpecification | LowPassAudioSpecification | HighPassAudioSpecification | DelayAudioSpecification | ReverbAudioSpecification | TremoloAudioSpecification

RenderableEffect module-attribute

RenderableEffect = FadeToEffectCustomization | FadeFromEffectCustomization | PaintEffectCustomization | SaturateEffectCustomization | LightenEffectCustomization | DarkenEffectCustomization | SweepInEffectCustomization | SweepOutEffectCustomization | SlideInEffectCustomization | SlideOutEffectCustomization | HslShiftEffectCustomization | DissolveEffectCustomization | CoalesceEffectCustomization | GlitchEffectCustomization | SleepEffectCustomization | EvolveEffectCustomization | EvolveIntoEffectCustomization | EvolveFromEffectCustomization | ExpandEffectCustomization | StretchEffectCustomization | ExplodeEffectCustomization

A visual effect as fx(...) and the methods of placement.fx and context.fx return it.

RenderableEffectKind module-attribute

RenderableEffectKind = Literal['effect.fade_to', 'effect.fade_from', 'effect.paint', 'effect.saturate', 'effect.lighten', 'effect.darken', 'effect.sweep_in', 'effect.sweep_out', 'effect.slide_in', 'effect.slide_out', 'effect.hsl_shift', 'effect.dissolve', 'effect.coalesce', 'effect.glitch', 'effect.sleep', 'effect.evolve', 'effect.evolve_into', 'effect.evolve_from', 'effect.expand', 'effect.stretch', 'effect.explode']

The kinds of effect that change how a buffer looks: fx kinds that start with 'effect.'.

RenderableEffectSpecification module-attribute

RenderableEffectSpecification = FadeToEffectSpecification | FadeFromEffectSpecification | PaintEffectSpecification | SaturateEffectSpecification | LightenEffectSpecification | DarkenEffectSpecification | SweepInEffectSpecification | SweepOutEffectSpecification | SlideInEffectSpecification | SlideOutEffectSpecification | HslShiftEffectSpecification | DissolveEffectSpecification | CoalesceEffectSpecification | GlitchEffectSpecification | SleepEffectSpecification | EvolveEffectSpecification | EvolveIntoEffectSpecification | EvolveFromEffectSpecification | ExpandEffectSpecification | StretchEffectSpecification | ExplodeEffectSpecification

Hook module-attribute

Hook: TypeAlias = Callable[[Context[DepsT, StateT]], 'object | HookGenerator[DepsT, StateT]'] | Callable[[], 'object | HookGenerator[DepsT, StateT]']

HookGenerator module-attribute

HookGenerator: TypeAlias = Generator[None, Context[DepsT, StateT], None]

A hook that spans several events: it receives the next context at each bare yield.

HookKind module-attribute

HookKind: TypeAlias = Literal['frame', 'tick', 'beat', 'key', 'mouse', 'scroll', 'drag', 'paste', 'focus', 'resize', 'state', 'custom']

When module-attribute

When: TypeAlias = 'str | Callable[[Context[DepsT, StateT]], bool] | _core.Expression[bool]'

The condition of a hook: an expression, a function of the context, or a string.

  • An expression built from the scopes in xnano.expressions, such as Keyboard.key == 'q', is checked by the runtime before Python is called.
  • A function takes the context and returns True when the hook should run.
  • A string such as "keyboard.key == 'q' and not mouse.is_down" is parsed once. It uses the names keyboard, mouse, scroll, buffer, parent, root, time and deps, and the operators ==, !=, <, <=, >, >=, in, and, or and not.

A value the event did not carry, such as keyboard.key while a mouse event arrives, is neither equal to nor different from anything, so every comparison with it is false.

Anchor module-attribute

Anchor: TypeAlias = tuple[int, int]

The (x, y) pixel inside an Art that sits at the art's (x, y).

anchor=(3, 8) makes (x, y) the place a character's feet touch; (0, 0) is the top-left pixel.

Axis module-attribute

One number of a position or size: x, y, width or height.

  • 12: exactly that many cells.
  • '50%': that share of the parent.
  • a word that places it inside its parent: 'left', 'center' or 'right' for x, and 'top', 'center' or 'bottom' for y.
  • an expression such as (ParentWidth - Width) // 2 or ParentWidth * (TimeElapsed % 4 / 4): evaluated again on every frame, with TimeElapsed and the other clock references moving with the canvas's clock.
  • a range, a pair (low, high): not a value but a limit on the values the axis may take. For x and y it is how far the placement may travel, such as the track of a slider; for width and height it is the smallest and largest size. Whatever is assigned afterwards is held inside the range, and the range stays until another one replaces it. Each bound is a number, a percentage string or an expression, and None leaves that side open.

CanvasLayout module-attribute

CanvasLayout: TypeAlias = Literal['overlay', 'column', 'row']

How a canvas places what is written on it.

'overlay' places every piece on its own, over the whole canvas. 'column' stacks the pieces from top to bottom in the order they are written, and 'row' from left to right.

ColorValue module-attribute

ColorValue: TypeAlias = 'Color | ColorName | str | tuple[int, int, int]'

A color, an ANSI color name, a '#rrggbb' string, or a (red, green, blue) tuple.

A Tailwind name such as 'slate-400' is a TailwindColorBinding. It is not parsed by Color.

Content module-attribute

Content: TypeAlias = 'Renderable | Playable'

EdgeBehavior module-attribute

EdgeBehavior: TypeAlias = Literal['clip', 'stop', 'wrap']

HeldMouseButtonName module-attribute

HeldMouseButtonName: TypeAlias = Literal['mouse_left', 'mouse_right', 'mouse_middle']

The name of a mouse button in the held-input vocabulary of Input.

Input.is_down('mouse_left') asks whether the left button is held. The button of a mouse event keeps the names 'left', 'right' and 'middle'.

HorizontalPosition module-attribute

HorizontalPosition: TypeAlias = Literal['left', 'center', 'right']

A word that places something inside its parent along x.

Interpolation module-attribute

Interpolation: TypeAlias = Literal['linear', 'back_in', 'back_out', 'back_in_out', 'bounce_in', 'bounce_out', 'bounce_in_out', 'circ_in', 'circ_out', 'circ_in_out', 'cubic_in', 'cubic_out', 'cubic_in_out', 'elastic_in', 'elastic_out', 'elastic_in_out', 'expo_in', 'expo_out', 'expo_in_out', 'quad_in', 'quad_out', 'quad_in_out', 'quart_in', 'quart_out', 'quart_in_out', 'quint_in', 'quint_out', 'quint_in_out', 'sine_in', 'sine_out', 'sine_in_out', 'smooth_step', 'spring', 'reverse', 'ease_in']

How an effect eases between its start and end: 'linear', or a curve such as 'quad_in_out' or 'bounce_out'. 'ease_in' is 'quad_in'.

KeyName module-attribute

KeyName: TypeAlias = Literal['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'space', 'enter', 'escape', 'tab', 'backspace', 'delete', 'insert', 'home', 'end', 'page_up', 'page_down', 'up', 'down', 'left', 'right', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12'] | str

The name of a key such as 'q', 'enter' or 'page_up'.

A key with modifiers is written as a chord joined with +, such as 'ctrl+s' or 'shift+tab'; the trailing str lets a chord and punctuation keys type-check while editors still suggest the names listed here.

MotionDirection module-attribute

MotionDirection: TypeAlias = Literal['left_to_right', 'right_to_left', 'up_to_down', 'down_to_up']

The direction a sweep, slide or stretch effect moves in.

Percentage module-attribute

Percentage: TypeAlias = Literal['5%', '10%', '15%', '20%', '25%', '30%', '35%', '40%', '45%', '50%', '55%', '60%', '65%', '70%', '75%', '80%', '85%', '90%', '95%', '100%']

A share of the space a size or position is measured against, such as '50%'.

Editors suggest the steps of 5% listed here, and every other percentage, such as '33%' or '12.5%', works the same way; a parameter that takes a percentage also takes any str.

PixelEncoding module-attribute

PixelEncoding: TypeAlias = Literal['half_blocks', 'braille']

'half_blocks': one column and two rows of pixels per cell. 'braille': two by four.

Playable module-attribute

Playable: TypeAlias = 'str | Note | Audio | SupportsPlay | Sequence[Playable]'

Anything play and Canvas.play accept: a Note, an Audio, an object with __xnano_play__, a sequence of those that plays one after another, or a str: the name of a registered symbol, a note name such as 'C#4', or melody text such as 'C4 E4 G4:2'.

PlaySource module-attribute

PlaySource: TypeAlias = 'Playable | int | float | TerminalSound | TerminalNote | TerminalMelody'

Anything play and Canvas.play accept: a Playable (a Note, an Audio, a symbol name, a note name such as 'C#4', melody text, or a sequence of those), a MIDI note number such as 60, a frequency in hertz, or a rendered sound, note or melody from xnano-audio.

RangeBound module-attribute

RangeBound: TypeAlias = Number | Percentage | str | NumericExpression | None

One end of a range as written: cells, a percentage string, an expression, or None.

Renderable module-attribute

Renderable: TypeAlias = 'str | Region | Art | Pixel | Image | Buffer | SupportsRender | Sequence[Renderable]'

VerticalPosition module-attribute

VerticalPosition: TypeAlias = Literal['top', 'center', 'bottom']

A word that places something inside its parent along y.

PixelPreset module-attribute

PixelPreset: TypeAlias = Literal['block', 'half_top', 'half_bottom', 'shade_light', 'shade_medium', 'shade_dark', 'braille', 'circle', 'circle_outline', 'dot', 'diamond', 'star', 'line_horizontal', 'line_vertical', 'corner_top_left_rounded', 'corner_top_right_rounded', 'corner_bottom_left_rounded', 'corner_bottom_right_rounded', 'corner_top_left_square', 'corner_top_right_square', 'corner_bottom_left_square', 'corner_bottom_right_square', 'arrow_up', 'arrow_down', 'arrow_left', 'arrow_right', 'check', 'cross']

The names of the characters Pixel knows: Pixel('diamond') draws ◆.

SpacingDictionary

Bases: TypedDict

Space around text, edge by edge.

Attributes:

EffectController

EffectController(context: Context[object, object])

Bases: _RenderableEffectMethods, _PlayableEffectMethods

The effects of the hook that is running, one method for each effect.

Get it from context.fx. A visual effect (context.fx.fade_to(...)) starts on the hook's buffer, and a sound effect (context.fx.reverb(...)) is added to every sound the hook plays. The effects last while the hook does; clear() ends them sooner, and removing the hook or its placement ends them too. Starting an effect of a kind that is already set replaces the earlier one.

Attributes:

Examples:

import xnano

with xnano.new(width=8, height=1) as canvas:
    label = canvas.write('hi')
    counts = []

    @label.hook(on='frame')
    def tint(context: xnano.Context) -> None:
        if not context.fx.active:
            context.fx.fade_to(foreground='red', duration_milliseconds=100)
        counts.append(len(context.fx.active))

    canvas.step(delta_seconds=0.05)
    assert counts and set(counts) == {1}

Create the controller of a context. Use context.fx instead of calling this.

Parameters:

Methods:

  • bit_crush –

    Lower the resolution of the sound, for a gritty, retro tone.

  • distortion –

    Distort the sound by driving it into soft clipping.

  • low_pass –

    Keep the frequencies below cutoff and soften those above it.

  • high_pass –

    Keep the frequencies above cutoff and soften those below it.

  • delay –

    Repeat the sound as fading echoes.

  • reverb –

    Add the reverberation of a room.

  • tremolo –

    Pulse the volume up and down.

  • fade_to –

    Fade the colors to foreground and background.

  • fade_from –

    Fade the colors in from foreground and background.

  • paint –

    Paint foreground and background over the colors.

  • saturate –

    Make the colors more or less saturated.

  • lighten –

    Lighten the colors.

  • darken –

    Darken the colors.

  • sweep_in –

    Reveal the content behind a sweep of color in direction.

  • sweep_out –

    Hide the content behind a sweep of color in direction.

  • slide_in –

    Slide the content in, in direction.

  • slide_out –

    Slide the content out, in direction.

  • hsl_shift –

    Shift the hue, saturation and lightness of the colors.

  • dissolve –

    Dissolve the content into style, cell by cell.

  • coalesce –

    Bring the content together out of style, cell by cell.

  • glitch –

    Make a share of the cells glitch for a moment.

  • sleep –

    Wait for duration_milliseconds without changing anything.

  • evolve –

    Cycle the cells through a progression of symbols.

  • evolve_into –

    Turn the content into a progression of symbols.

  • evolve_from –

    Grow the content out of a progression of symbols.

  • expand –

    Expand style outward from the center.

  • stretch –

    Stretch style across the area in direction.

  • explode –

    Throw the cells outward.

  • clear –

    End the effects this hook has set.

Source code in xnano/_effect_controller.py
def __init__(self, context: Context[object, object]) -> None:
    """
    Create the controller of a context. Use ``context.fx`` instead of calling this.

    Args:
        context: The context of the hook that applies the effects.
    """
    self._context = context

context property

context: Context[object, object]

The context of the hook that applies the effects.

active property

active: tuple[EffectCustomization, ...]

The effects the hook has set and not cleared or replaced.

bit_crush

bit_crush(**parameters: Unpack[BitCrushAudioArguments]) -> BitCrushAudioCustomization

Lower the resolution of the sound, for a gritty, retro tone.

Other Parameters:

  • bits (int) –

    Quantization resolution in bits (1 to 16).

  • downsample (int) –

    Sample-hold factor (1 to 256).

Returns:

  • BitCrushAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def bit_crush(
    self, **parameters: Unpack[BitCrushAudioArguments]
) -> BitCrushAudioCustomization:
    """
    Lower the resolution of the sound, for a gritty, retro tone.

    Keyword Args:
        bits (int): Quantization resolution in bits (``1`` to ``16``).
        downsample (int): Sample-hold factor (``1`` to ``256``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast(
        'BitCrushAudioCustomization', self._start('audio.bit_crush', parameters)
    )

distortion

distortion(**parameters: Unpack[DistortionAudioArguments]) -> DistortionAudioCustomization

Distort the sound by driving it into soft clipping.

Other Parameters:

  • drive (float) –

    Input gain before soft-clipping (0.1 to 100.0).

Returns:

  • DistortionAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def distortion(
    self, **parameters: Unpack[DistortionAudioArguments]
) -> DistortionAudioCustomization:
    """
    Distort the sound by driving it into soft clipping.

    Keyword Args:
        drive (float): Input gain before soft-clipping (``0.1`` to ``100.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast(
        'DistortionAudioCustomization', self._start('audio.distortion', parameters)
    )

low_pass

low_pass(**parameters: Unpack[LowPassAudioArguments]) -> LowPassAudioCustomization

Keep the frequencies below cutoff and soften those above it.

Other Parameters:

  • cutoff (float) –

    Corner frequency in hertz (20.0 to 20000.0).

  • resonance (float) –

    Filter resonance Q (0.1 to 20.0).

Returns:

  • LowPassAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def low_pass(
    self, **parameters: Unpack[LowPassAudioArguments]
) -> LowPassAudioCustomization:
    """
    Keep the frequencies below ``cutoff`` and soften those above it.

    Keyword Args:
        cutoff (float): Corner frequency in hertz (``20.0`` to ``20000.0``).
        resonance (float): Filter resonance Q (``0.1`` to ``20.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast(
        'LowPassAudioCustomization', self._start('audio.low_pass', parameters)
    )

high_pass

high_pass(**parameters: Unpack[HighPassAudioArguments]) -> HighPassAudioCustomization

Keep the frequencies above cutoff and soften those below it.

Other Parameters:

  • cutoff (float) –

    Corner frequency in hertz (20.0 to 20000.0).

  • resonance (float) –

    Filter resonance Q (0.1 to 20.0).

Returns:

  • HighPassAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def high_pass(
    self, **parameters: Unpack[HighPassAudioArguments]
) -> HighPassAudioCustomization:
    """
    Keep the frequencies above ``cutoff`` and soften those below it.

    Keyword Args:
        cutoff (float): Corner frequency in hertz (``20.0`` to ``20000.0``).
        resonance (float): Filter resonance Q (``0.1`` to ``20.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast(
        'HighPassAudioCustomization', self._start('audio.high_pass', parameters)
    )

delay

delay(**parameters: Unpack[DelayAudioArguments]) -> DelayAudioCustomization

Repeat the sound as fading echoes.

Other Parameters:

  • time_milliseconds (float) –

    Delay time between echoes in milliseconds (1.0 to 2000.0).

  • feedback (float) –

    Echo feedback ratio (0.0 to 0.95).

  • mix (float) –

    Wet/dry mix ratio (0.0 to 1.0).

Returns:

  • DelayAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def delay(self, **parameters: Unpack[DelayAudioArguments]) -> DelayAudioCustomization:
    """
    Repeat the sound as fading echoes.

    Keyword Args:
        time_milliseconds (float): Delay time between echoes in milliseconds (``1.0`` to ``2000.0``).
        feedback (float): Echo feedback ratio (``0.0`` to ``0.95``).
        mix (float): Wet/dry mix ratio (``0.0`` to ``1.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast('DelayAudioCustomization', self._start('audio.delay', parameters))

reverb

reverb(**parameters: Unpack[ReverbAudioArguments]) -> ReverbAudioCustomization

Add the reverberation of a room.

Other Parameters:

  • room (float) –

    Room size (0.0 to 1.0).

  • damping (float) –

    High-frequency damping (0.0 to 1.0).

  • mix (float) –

    Wet/dry mix ratio (0.0 to 1.0).

Returns:

  • ReverbAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def reverb(
    self, **parameters: Unpack[ReverbAudioArguments]
) -> ReverbAudioCustomization:
    """
    Add the reverberation of a room.

    Keyword Args:
        room (float): Room size (``0.0`` to ``1.0``).
        damping (float): High-frequency damping (``0.0`` to ``1.0``).
        mix (float): Wet/dry mix ratio (``0.0`` to ``1.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast('ReverbAudioCustomization', self._start('audio.reverb', parameters))

tremolo

tremolo(**parameters: Unpack[TremoloAudioArguments]) -> TremoloAudioCustomization

Pulse the volume up and down.

Other Parameters:

  • rate_hertz (float) –

    Modulation rate in hertz (0.1 to 40.0).

  • depth (float) –

    Modulation depth (0.0 to 1.0).

Returns:

  • TremoloAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def tremolo(
    self, **parameters: Unpack[TremoloAudioArguments]
) -> TremoloAudioCustomization:
    """
    Pulse the volume up and down.

    Keyword Args:
        rate_hertz (float): Modulation rate in hertz (``0.1`` to ``40.0``).
        depth (float): Modulation depth (``0.0`` to ``1.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast('TremoloAudioCustomization', self._start('audio.tremolo', parameters))

fade_to

fade_to(**parameters: Unpack[FadeToEffectArguments]) -> FadeToEffectCustomization

Fade the colors to foreground and background.

Other Parameters:

  • foreground (ColorValue | Expression[ColorValue] | None) –

    Target foreground color, or None.

  • background (ColorValue | Expression[ColorValue] | None) –

    Target background color, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration of the fade in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • FadeToEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • FadeToEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def fade_to(
    self, **parameters: Unpack[FadeToEffectArguments]
) -> FadeToEffectCustomization:
    """
    Fade the colors to ``foreground`` and ``background``.

    Keyword Args:
        foreground (ColorValue | Expression[ColorValue] | None): Target foreground color, or ``None``.
        background (ColorValue | Expression[ColorValue] | None): Target background color, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration of the fade in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'FadeToEffectCustomization', self._start('effect.fade_to', parameters)
    )

fade_from

fade_from(**parameters: Unpack[FadeFromEffectArguments]) -> FadeFromEffectCustomization

Fade the colors in from foreground and background.

Other Parameters:

  • foreground (ColorValue | Expression[ColorValue] | None) –

    Starting foreground color, or None.

  • background (ColorValue | Expression[ColorValue] | None) –

    Starting background color, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration of the fade in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • FadeFromEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • FadeFromEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def fade_from(
    self, **parameters: Unpack[FadeFromEffectArguments]
) -> FadeFromEffectCustomization:
    """
    Fade the colors in from ``foreground`` and ``background``.

    Keyword Args:
        foreground (ColorValue | Expression[ColorValue] | None): Starting foreground color, or ``None``.
        background (ColorValue | Expression[ColorValue] | None): Starting background color, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration of the fade in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'FadeFromEffectCustomization', self._start('effect.fade_from', parameters)
    )

paint

paint(**parameters: Unpack[PaintEffectArguments]) -> PaintEffectCustomization

Paint foreground and background over the colors.

Other Parameters:

  • foreground (ColorValue | Expression[ColorValue] | None) –

    Foreground color to paint, or None.

  • background (ColorValue | Expression[ColorValue] | None) –

    Background color to paint, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • PaintEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • PaintEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def paint(
    self, **parameters: Unpack[PaintEffectArguments]
) -> PaintEffectCustomization:
    """
    Paint ``foreground`` and ``background`` over the colors.

    Keyword Args:
        foreground (ColorValue | Expression[ColorValue] | None): Foreground color to paint, or ``None``.
        background (ColorValue | Expression[ColorValue] | None): Background color to paint, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('PaintEffectCustomization', self._start('effect.paint', parameters))

saturate

saturate(**parameters: Unpack[SaturateEffectArguments]) -> SaturateEffectCustomization

Make the colors more or less saturated.

Other Parameters:

  • foreground (float | Expression[int | float] | None) –

    Foreground saturation change, or None.

  • background (float | Expression[int | float] | None) –

    Background saturation change, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SaturateEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SaturateEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def saturate(
    self, **parameters: Unpack[SaturateEffectArguments]
) -> SaturateEffectCustomization:
    """
    Make the colors more or less saturated.

    Keyword Args:
        foreground (float | Expression[int | float] | None): Foreground saturation change, or ``None``.
        background (float | Expression[int | float] | None): Background saturation change, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'SaturateEffectCustomization', self._start('effect.saturate', parameters)
    )

lighten

lighten(**parameters: Unpack[LightenEffectArguments]) -> LightenEffectCustomization

Lighten the colors.

Other Parameters:

  • foreground (float | Expression[int | float] | None) –

    Foreground lightness increase, or None.

  • background (float | Expression[int | float] | None) –

    Background lightness increase, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • LightenEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • LightenEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def lighten(
    self, **parameters: Unpack[LightenEffectArguments]
) -> LightenEffectCustomization:
    """
    Lighten the colors.

    Keyword Args:
        foreground (float | Expression[int | float] | None): Foreground lightness increase, or ``None``.
        background (float | Expression[int | float] | None): Background lightness increase, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'LightenEffectCustomization', self._start('effect.lighten', parameters)
    )

darken

darken(**parameters: Unpack[DarkenEffectArguments]) -> DarkenEffectCustomization

Darken the colors.

Other Parameters:

  • foreground (float | Expression[int | float] | None) –

    Foreground darkness increase, or None.

  • background (float | Expression[int | float] | None) –

    Background darkness increase, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • DarkenEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • DarkenEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def darken(
    self, **parameters: Unpack[DarkenEffectArguments]
) -> DarkenEffectCustomization:
    """
    Darken the colors.

    Keyword Args:
        foreground (float | Expression[int | float] | None): Foreground darkness increase, or ``None``.
        background (float | Expression[int | float] | None): Background darkness increase, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('DarkenEffectCustomization', self._start('effect.darken', parameters))

sweep_in

sweep_in(**parameters: Unpack[SweepInEffectArguments]) -> SweepInEffectCustomization

Reveal the content behind a sweep of color in direction.

Other Parameters:

  • direction (MotionDirection | Expression[str] | None) –

    Sweep direction (such as 'left_to_right').

  • gradient_length (int | Expression[int | float] | None) –

    Length of the sweep gradient in cells.

  • randomness (int | Expression[int | float] | None) –

    Random offset across rows or columns.

  • color (ColorValue | Expression[ColorValue] | None) –

    Starting sweep color.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SweepInEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SweepInEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def sweep_in(
    self, **parameters: Unpack[SweepInEffectArguments]
) -> SweepInEffectCustomization:
    """
    Reveal the content behind a sweep of ``color`` in ``direction``.

    Keyword Args:
        direction (MotionDirection | Expression[str] | None): Sweep direction (such as ``'left_to_right'``).
        gradient_length (int | Expression[int | float] | None): Length of the sweep gradient in cells.
        randomness (int | Expression[int | float] | None): Random offset across rows or columns.
        color (ColorValue | Expression[ColorValue] | None): Starting sweep color.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'SweepInEffectCustomization', self._start('effect.sweep_in', parameters)
    )

sweep_out

sweep_out(**parameters: Unpack[SweepOutEffectArguments]) -> SweepOutEffectCustomization

Hide the content behind a sweep of color in direction.

Other Parameters:

  • direction (MotionDirection | Expression[str] | None) –

    Sweep direction (such as 'left_to_right').

  • gradient_length (int | Expression[int | float] | None) –

    Length of the sweep gradient in cells.

  • randomness (int | Expression[int | float] | None) –

    Random offset across rows or columns.

  • color (ColorValue | Expression[ColorValue] | None) –

    Ending sweep color.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SweepOutEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SweepOutEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def sweep_out(
    self, **parameters: Unpack[SweepOutEffectArguments]
) -> SweepOutEffectCustomization:
    """
    Hide the content behind a sweep of ``color`` in ``direction``.

    Keyword Args:
        direction (MotionDirection | Expression[str] | None): Sweep direction (such as ``'left_to_right'``).
        gradient_length (int | Expression[int | float] | None): Length of the sweep gradient in cells.
        randomness (int | Expression[int | float] | None): Random offset across rows or columns.
        color (ColorValue | Expression[ColorValue] | None): Ending sweep color.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'SweepOutEffectCustomization', self._start('effect.sweep_out', parameters)
    )

slide_in

slide_in(**parameters: Unpack[SlideInEffectArguments]) -> SlideInEffectCustomization

Slide the content in, in direction.

Other Parameters:

  • direction (MotionDirection | Expression[str] | None) –

    Slide direction (such as 'left_to_right').

  • gradient_length (int | Expression[int | float] | None) –

    Length of the gradient trail in cells.

  • randomness (int | Expression[int | float] | None) –

    Random offset across rows or columns.

  • color (ColorValue | Expression[ColorValue] | None) –

    Color behind the sliding cells.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SlideInEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SlideInEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def slide_in(
    self, **parameters: Unpack[SlideInEffectArguments]
) -> SlideInEffectCustomization:
    """
    Slide the content in, in ``direction``.

    Keyword Args:
        direction (MotionDirection | Expression[str] | None): Slide direction (such as ``'left_to_right'``).
        gradient_length (int | Expression[int | float] | None): Length of the gradient trail in cells.
        randomness (int | Expression[int | float] | None): Random offset across rows or columns.
        color (ColorValue | Expression[ColorValue] | None): Color behind the sliding cells.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'SlideInEffectCustomization', self._start('effect.slide_in', parameters)
    )

slide_out

slide_out(**parameters: Unpack[SlideOutEffectArguments]) -> SlideOutEffectCustomization

Slide the content out, in direction.

Other Parameters:

  • direction (MotionDirection | Expression[str] | None) –

    Slide direction (such as 'left_to_right').

  • gradient_length (int | Expression[int | float] | None) –

    Length of the gradient trail in cells.

  • randomness (int | Expression[int | float] | None) –

    Random offset across rows or columns.

  • color (ColorValue | Expression[ColorValue] | None) –

    Color left behind the sliding cells.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SlideOutEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SlideOutEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def slide_out(
    self, **parameters: Unpack[SlideOutEffectArguments]
) -> SlideOutEffectCustomization:
    """
    Slide the content out, in ``direction``.

    Keyword Args:
        direction (MotionDirection | Expression[str] | None): Slide direction (such as ``'left_to_right'``).
        gradient_length (int | Expression[int | float] | None): Length of the gradient trail in cells.
        randomness (int | Expression[int | float] | None): Random offset across rows or columns.
        color (ColorValue | Expression[ColorValue] | None): Color left behind the sliding cells.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'SlideOutEffectCustomization', self._start('effect.slide_out', parameters)
    )

hsl_shift

hsl_shift(**parameters: Unpack[HslShiftEffectArguments]) -> HslShiftEffectCustomization

Shift the hue, saturation and lightness of the colors.

Other Parameters:

  • foreground (HslShiftTuple | None) –

    (hue, saturation, lightness) shift for foreground colors.

  • background (HslShiftTuple | None) –

    (hue, saturation, lightness) shift for background colors.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • HslShiftEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • HslShiftEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def hsl_shift(
    self, **parameters: Unpack[HslShiftEffectArguments]
) -> HslShiftEffectCustomization:
    """
    Shift the hue, saturation and lightness of the colors.

    Keyword Args:
        foreground (HslShiftTuple | None): ``(hue, saturation, lightness)`` shift for foreground colors.
        background (HslShiftTuple | None): ``(hue, saturation, lightness)`` shift for background colors.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'HslShiftEffectCustomization', self._start('effect.hsl_shift', parameters)
    )

dissolve

dissolve(**parameters: Unpack[DissolveEffectArguments]) -> DissolveEffectCustomization

Dissolve the content into style, cell by cell.

Other Parameters:

  • style (Style | DynamicStyle | None) –

    Style dissolved into.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • DissolveEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • DissolveEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def dissolve(
    self, **parameters: Unpack[DissolveEffectArguments]
) -> DissolveEffectCustomization:
    """
    Dissolve the content into ``style``, cell by cell.

    Keyword Args:
        style (Style | DynamicStyle | None): Style dissolved into.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'DissolveEffectCustomization', self._start('effect.dissolve', parameters)
    )

coalesce

coalesce(**parameters: Unpack[CoalesceEffectArguments]) -> CoalesceEffectCustomization

Bring the content together out of style, cell by cell.

Other Parameters:

  • style (Style | DynamicStyle | None) –

    Style coalesced from.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • CoalesceEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • CoalesceEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def coalesce(
    self, **parameters: Unpack[CoalesceEffectArguments]
) -> CoalesceEffectCustomization:
    """
    Bring the content together out of ``style``, cell by cell.

    Keyword Args:
        style (Style | DynamicStyle | None): Style coalesced from.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'CoalesceEffectCustomization', self._start('effect.coalesce', parameters)
    )

glitch

glitch(**parameters: Unpack[GlitchEffectArguments]) -> GlitchEffectCustomization

Make a share of the cells glitch for a moment.

Other Parameters:

  • ratio (float | Expression[int | float] | None) –

    Fraction of cells affected by the glitch.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • start_delay_milliseconds (tuple[int, int]) –

    (minimum, maximum) delay before a cell glitches.

  • action_milliseconds (tuple[int, int]) –

    (minimum, maximum) duration of each cell glitch.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • GlitchEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • GlitchEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def glitch(
    self, **parameters: Unpack[GlitchEffectArguments]
) -> GlitchEffectCustomization:
    """
    Make a share of the cells glitch for a moment.

    Keyword Args:
        ratio (float | Expression[int | float] | None): Fraction of cells affected by the glitch.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        start_delay_milliseconds (tuple[int, int]): ``(minimum, maximum)`` delay before a cell glitches.
        action_milliseconds (tuple[int, int]): ``(minimum, maximum)`` duration of each cell glitch.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('GlitchEffectCustomization', self._start('effect.glitch', parameters))

sleep

sleep(**parameters: Unpack[SleepEffectArguments]) -> SleepEffectCustomization

Wait for duration_milliseconds without changing anything.

Other Parameters:

  • duration_milliseconds (int | Expression[int | float]) –

    Pause duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SleepEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SleepEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def sleep(
    self, **parameters: Unpack[SleepEffectArguments]
) -> SleepEffectCustomization:
    """
    Wait for ``duration_milliseconds`` without changing anything.

    Keyword Args:
        duration_milliseconds (int | Expression[int | float]): Pause duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('SleepEffectCustomization', self._start('effect.sleep', parameters))

evolve

evolve(**parameters: Unpack[EvolveEffectArguments]) -> EvolveEffectCustomization

Cycle the cells through a progression of symbols.

Other Parameters:

  • symbols (EvolveSymbolSet | Expression[str] | None) –

    The symbols stepped through, such as 'circles', 'squares' or 'shaded'.

  • style (Style | DynamicStyle | None) –

    Optional style applied to the evolving symbols.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • EvolveEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • EvolveEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def evolve(
    self, **parameters: Unpack[EvolveEffectArguments]
) -> EvolveEffectCustomization:
    """
    Cycle the cells through a progression of ``symbols``.

    Keyword Args:
        symbols (EvolveSymbolSet | Expression[str] | None): The symbols stepped through, such as ``'circles'``, ``'squares'`` or ``'shaded'``.
        style (Style | DynamicStyle | None): Optional style applied to the evolving symbols.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('EvolveEffectCustomization', self._start('effect.evolve', parameters))

evolve_into

evolve_into(**parameters: Unpack[EvolveIntoEffectArguments]) -> EvolveIntoEffectCustomization

Turn the content into a progression of symbols.

Other Parameters:

  • symbols (EvolveSymbolSet | Expression[str] | None) –

    The symbols stepped through, such as 'circles', 'squares' or 'shaded'.

  • style (Style | DynamicStyle | None) –

    Optional style applied to the evolving symbols.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • EvolveIntoEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • EvolveIntoEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def evolve_into(
    self, **parameters: Unpack[EvolveIntoEffectArguments]
) -> EvolveIntoEffectCustomization:
    """
    Turn the content into a progression of ``symbols``.

    Keyword Args:
        symbols (EvolveSymbolSet | Expression[str] | None): The symbols stepped through, such as ``'circles'``, ``'squares'`` or ``'shaded'``.
        style (Style | DynamicStyle | None): Optional style applied to the evolving symbols.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'EvolveIntoEffectCustomization', self._start('effect.evolve_into', parameters)
    )

evolve_from

evolve_from(**parameters: Unpack[EvolveFromEffectArguments]) -> EvolveFromEffectCustomization

Grow the content out of a progression of symbols.

Other Parameters:

  • symbols (EvolveSymbolSet | Expression[str] | None) –

    The symbols stepped through, such as 'circles', 'squares' or 'shaded'.

  • style (Style | DynamicStyle | None) –

    Optional style applied to the evolving symbols.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • EvolveFromEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • EvolveFromEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def evolve_from(
    self, **parameters: Unpack[EvolveFromEffectArguments]
) -> EvolveFromEffectCustomization:
    """
    Grow the content out of a progression of ``symbols``.

    Keyword Args:
        symbols (EvolveSymbolSet | Expression[str] | None): The symbols stepped through, such as ``'circles'``, ``'squares'`` or ``'shaded'``.
        style (Style | DynamicStyle | None): Optional style applied to the evolving symbols.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'EvolveFromEffectCustomization', self._start('effect.evolve_from', parameters)
    )

expand

expand(**parameters: Unpack[ExpandEffectArguments]) -> ExpandEffectCustomization

Expand style outward from the center.

Other Parameters:

  • direction (Literal['horizontal', 'vertical'] | Expression[str] | None) –

    'horizontal' or 'vertical'.

  • style (Style | DynamicStyle | None) –

    Style expanded outward from the center.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • ExpandEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • ExpandEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def expand(
    self, **parameters: Unpack[ExpandEffectArguments]
) -> ExpandEffectCustomization:
    """
    Expand ``style`` outward from the center.

    Keyword Args:
        direction (Literal['horizontal', 'vertical'] | Expression[str] | None): ``'horizontal'`` or ``'vertical'``.
        style (Style | DynamicStyle | None): Style expanded outward from the center.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('ExpandEffectCustomization', self._start('effect.expand', parameters))

stretch

stretch(**parameters: Unpack[StretchEffectArguments]) -> StretchEffectCustomization

Stretch style across the area in direction.

Other Parameters:

  • direction (MotionDirection | Expression[str] | None) –

    'left_to_right', 'right_to_left', 'up_to_down' or 'down_to_up'.

  • style (Style | DynamicStyle | None) –

    Style stretched across the area.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • StretchEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • StretchEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def stretch(
    self, **parameters: Unpack[StretchEffectArguments]
) -> StretchEffectCustomization:
    """
    Stretch ``style`` across the area in ``direction``.

    Keyword Args:
        direction (MotionDirection | Expression[str] | None): ``'left_to_right'``, ``'right_to_left'``, ``'up_to_down'`` or ``'down_to_up'``.
        style (Style | DynamicStyle | None): Style stretched across the area.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'StretchEffectCustomization', self._start('effect.stretch', parameters)
    )

explode

explode(**parameters: Unpack[ExplodeEffectArguments]) -> ExplodeEffectCustomization

Throw the cells outward.

Other Parameters:

  • force (float | Expression[int | float] | None) –

    Outward force throwing the cells.

  • randomness (float | Expression[int | float] | None) –

    Variation in force from cell to cell.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • ExplodeEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • ExplodeEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def explode(
    self, **parameters: Unpack[ExplodeEffectArguments]
) -> ExplodeEffectCustomization:
    """
    Throw the cells outward.

    Keyword Args:
        force (float | Expression[int | float] | None): Outward force throwing the cells.
        randomness (float | Expression[int | float] | None): Variation in force from cell to cell.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'ExplodeEffectCustomization', self._start('effect.explode', parameters)
    )

clear

clear() -> None

End the effects this hook has set.

Visual effects stop on the buffer, and the hook's sound effects are not applied to what it plays. Does nothing when the hook has set none.

Source code in xnano/_effect_controller.py
def clear(self) -> None:
    """
    End the effects this hook has set.

    Visual effects stop on the buffer, and the hook's sound effects are not applied to what
    it plays. Does nothing when the hook has set none.
    """
    state = self._context.hook._effect_state
    if state is not None:
        state.clear()

PlayableEffects

PlayableEffects(device: AudioDevice)

Bases: _PlayableEffectMethods

The sound effects of a canvas's audio, one method for each effect.

Get it from AudioDevice.fx. Each method adds its effect to every sound the canvas plays from then on, after the sound's own effects. A sound that is already playing keeps the effects it started with. Adding an effect of a kind that is already there replaces the earlier one, and clear() removes them all.

Attributes:

Examples:

import xnano

with xnano.new(width=8, height=1) as canvas:
    echo = canvas.audio.fx.delay(time_milliseconds=120.0, feedback=0.4)
    assert canvas.audio.fx.active == (echo,)
    canvas.play('C4')
    canvas.audio.fx.clear()
    assert canvas.audio.fx.active == ()

Create the sound effects of a canvas's audio. Use canvas.audio.fx instead.

Parameters:

  • device (AudioDevice) –

    The audio the effects are added to.

Methods:

  • bit_crush –

    Lower the resolution of the sound, for a gritty, retro tone.

  • distortion –

    Distort the sound by driving it into soft clipping.

  • low_pass –

    Keep the frequencies below cutoff and soften those above it.

  • high_pass –

    Keep the frequencies above cutoff and soften those below it.

  • delay –

    Repeat the sound as fading echoes.

  • reverb –

    Add the reverberation of a room.

  • tremolo –

    Pulse the volume up and down.

  • clear –

    Remove every effect added here, for the sounds played after this.

Source code in xnano/_effect_controller.py
def __init__(self, device: AudioDevice) -> None:
    """
    Create the sound effects of a canvas's audio. Use ``canvas.audio.fx`` instead.

    Args:
        device: The audio the effects are added to.
    """
    self._device = device
    self._running: dict[str, AudioCustomization] = {}

active property

active: tuple[PlayableEffect, ...]

The effects added here and not cleared or replaced.

bit_crush

bit_crush(**parameters: Unpack[BitCrushAudioArguments]) -> BitCrushAudioCustomization

Lower the resolution of the sound, for a gritty, retro tone.

Other Parameters:

  • bits (int) –

    Quantization resolution in bits (1 to 16).

  • downsample (int) –

    Sample-hold factor (1 to 256).

Returns:

  • BitCrushAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def bit_crush(
    self, **parameters: Unpack[BitCrushAudioArguments]
) -> BitCrushAudioCustomization:
    """
    Lower the resolution of the sound, for a gritty, retro tone.

    Keyword Args:
        bits (int): Quantization resolution in bits (``1`` to ``16``).
        downsample (int): Sample-hold factor (``1`` to ``256``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast(
        'BitCrushAudioCustomization', self._start('audio.bit_crush', parameters)
    )

distortion

distortion(**parameters: Unpack[DistortionAudioArguments]) -> DistortionAudioCustomization

Distort the sound by driving it into soft clipping.

Other Parameters:

  • drive (float) –

    Input gain before soft-clipping (0.1 to 100.0).

Returns:

  • DistortionAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def distortion(
    self, **parameters: Unpack[DistortionAudioArguments]
) -> DistortionAudioCustomization:
    """
    Distort the sound by driving it into soft clipping.

    Keyword Args:
        drive (float): Input gain before soft-clipping (``0.1`` to ``100.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast(
        'DistortionAudioCustomization', self._start('audio.distortion', parameters)
    )

low_pass

low_pass(**parameters: Unpack[LowPassAudioArguments]) -> LowPassAudioCustomization

Keep the frequencies below cutoff and soften those above it.

Other Parameters:

  • cutoff (float) –

    Corner frequency in hertz (20.0 to 20000.0).

  • resonance (float) –

    Filter resonance Q (0.1 to 20.0).

Returns:

  • LowPassAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def low_pass(
    self, **parameters: Unpack[LowPassAudioArguments]
) -> LowPassAudioCustomization:
    """
    Keep the frequencies below ``cutoff`` and soften those above it.

    Keyword Args:
        cutoff (float): Corner frequency in hertz (``20.0`` to ``20000.0``).
        resonance (float): Filter resonance Q (``0.1`` to ``20.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast(
        'LowPassAudioCustomization', self._start('audio.low_pass', parameters)
    )

high_pass

high_pass(**parameters: Unpack[HighPassAudioArguments]) -> HighPassAudioCustomization

Keep the frequencies above cutoff and soften those below it.

Other Parameters:

  • cutoff (float) –

    Corner frequency in hertz (20.0 to 20000.0).

  • resonance (float) –

    Filter resonance Q (0.1 to 20.0).

Returns:

  • HighPassAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def high_pass(
    self, **parameters: Unpack[HighPassAudioArguments]
) -> HighPassAudioCustomization:
    """
    Keep the frequencies above ``cutoff`` and soften those below it.

    Keyword Args:
        cutoff (float): Corner frequency in hertz (``20.0`` to ``20000.0``).
        resonance (float): Filter resonance Q (``0.1`` to ``20.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast(
        'HighPassAudioCustomization', self._start('audio.high_pass', parameters)
    )

delay

delay(**parameters: Unpack[DelayAudioArguments]) -> DelayAudioCustomization

Repeat the sound as fading echoes.

Other Parameters:

  • time_milliseconds (float) –

    Delay time between echoes in milliseconds (1.0 to 2000.0).

  • feedback (float) –

    Echo feedback ratio (0.0 to 0.95).

  • mix (float) –

    Wet/dry mix ratio (0.0 to 1.0).

Returns:

  • DelayAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def delay(self, **parameters: Unpack[DelayAudioArguments]) -> DelayAudioCustomization:
    """
    Repeat the sound as fading echoes.

    Keyword Args:
        time_milliseconds (float): Delay time between echoes in milliseconds (``1.0`` to ``2000.0``).
        feedback (float): Echo feedback ratio (``0.0`` to ``0.95``).
        mix (float): Wet/dry mix ratio (``0.0`` to ``1.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast('DelayAudioCustomization', self._start('audio.delay', parameters))

reverb

reverb(**parameters: Unpack[ReverbAudioArguments]) -> ReverbAudioCustomization

Add the reverberation of a room.

Other Parameters:

  • room (float) –

    Room size (0.0 to 1.0).

  • damping (float) –

    High-frequency damping (0.0 to 1.0).

  • mix (float) –

    Wet/dry mix ratio (0.0 to 1.0).

Returns:

  • ReverbAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def reverb(
    self, **parameters: Unpack[ReverbAudioArguments]
) -> ReverbAudioCustomization:
    """
    Add the reverberation of a room.

    Keyword Args:
        room (float): Room size (``0.0`` to ``1.0``).
        damping (float): High-frequency damping (``0.0`` to ``1.0``).
        mix (float): Wet/dry mix ratio (``0.0`` to ``1.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast('ReverbAudioCustomization', self._start('audio.reverb', parameters))

tremolo

tremolo(**parameters: Unpack[TremoloAudioArguments]) -> TremoloAudioCustomization

Pulse the volume up and down.

Other Parameters:

  • rate_hertz (float) –

    Modulation rate in hertz (0.1 to 40.0).

  • depth (float) –

    Modulation depth (0.0 to 1.0).

Returns:

  • TremoloAudioCustomization –

    The effect. Assigning one of its fields changes the sounds played after that.

Source code in xnano/_effect_controller.py
def tremolo(
    self, **parameters: Unpack[TremoloAudioArguments]
) -> TremoloAudioCustomization:
    """
    Pulse the volume up and down.

    Keyword Args:
        rate_hertz (float): Modulation rate in hertz (``0.1`` to ``40.0``).
        depth (float): Modulation depth (``0.0`` to ``1.0``).

    Returns:
        The effect. Assigning one of its fields changes the sounds played after that.
    """
    return cast('TremoloAudioCustomization', self._start('audio.tremolo', parameters))

clear

clear() -> None

Remove every effect added here, for the sounds played after this.

Source code in xnano/_effect_controller.py
def clear(self) -> None:
    """Remove every effect added here, for the sounds played after this."""
    self._running.clear()

RenderableEffects

RenderableEffects(target: Canvas[object, object] | Placement[object, object])

Bases: _RenderableEffectMethods

The visual effects of a placement or a canvas, one method for each effect.

Get it from Placement.fx or Canvas.fx. Each method starts its effect on that placement or canvas at once and returns it while it runs. Starting an effect of a kind that is already running replaces the earlier one, clear() stops them all, and removing the placement stops its effects too.

Attributes:

Examples:

import xnano

with xnano.new(width=8, height=1) as canvas:
    label = canvas.write('hi')
    fade = label.fx.fade_to(foreground='red', duration_milliseconds=100)
    assert label.fx.active == (fade,)
    label.fx.clear()
    assert label.fx.active == ()

Create the effects of a placement or canvas. Use placement.fx instead.

Parameters:

Methods:

  • fade_to –

    Fade the colors to foreground and background.

  • fade_from –

    Fade the colors in from foreground and background.

  • paint –

    Paint foreground and background over the colors.

  • saturate –

    Make the colors more or less saturated.

  • lighten –

    Lighten the colors.

  • darken –

    Darken the colors.

  • sweep_in –

    Reveal the content behind a sweep of color in direction.

  • sweep_out –

    Hide the content behind a sweep of color in direction.

  • slide_in –

    Slide the content in, in direction.

  • slide_out –

    Slide the content out, in direction.

  • hsl_shift –

    Shift the hue, saturation and lightness of the colors.

  • dissolve –

    Dissolve the content into style, cell by cell.

  • coalesce –

    Bring the content together out of style, cell by cell.

  • glitch –

    Make a share of the cells glitch for a moment.

  • sleep –

    Wait for duration_milliseconds without changing anything.

  • evolve –

    Cycle the cells through a progression of symbols.

  • evolve_into –

    Turn the content into a progression of symbols.

  • evolve_from –

    Grow the content out of a progression of symbols.

  • expand –

    Expand style outward from the center.

  • stretch –

    Stretch style across the area in direction.

  • explode –

    Throw the cells outward.

  • clear –

    Stop every effect started here. Does nothing when none was started.

Source code in xnano/_effect_controller.py
def __init__(
    self, target: Canvas[object, object] | Placement[object, object]
) -> None:
    """
    Create the effects of a placement or canvas. Use ``placement.fx`` instead.

    Args:
        target: The placement or canvas the effects run on.
    """
    self._target = target
    self._running: dict[str, Customization] = {}

active property

active: tuple[RenderableEffect, ...]

The effects started here and not cleared or replaced.

fade_to

fade_to(**parameters: Unpack[FadeToEffectArguments]) -> FadeToEffectCustomization

Fade the colors to foreground and background.

Other Parameters:

  • foreground (ColorValue | Expression[ColorValue] | None) –

    Target foreground color, or None.

  • background (ColorValue | Expression[ColorValue] | None) –

    Target background color, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration of the fade in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • FadeToEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • FadeToEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def fade_to(
    self, **parameters: Unpack[FadeToEffectArguments]
) -> FadeToEffectCustomization:
    """
    Fade the colors to ``foreground`` and ``background``.

    Keyword Args:
        foreground (ColorValue | Expression[ColorValue] | None): Target foreground color, or ``None``.
        background (ColorValue | Expression[ColorValue] | None): Target background color, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration of the fade in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'FadeToEffectCustomization', self._start('effect.fade_to', parameters)
    )

fade_from

fade_from(**parameters: Unpack[FadeFromEffectArguments]) -> FadeFromEffectCustomization

Fade the colors in from foreground and background.

Other Parameters:

  • foreground (ColorValue | Expression[ColorValue] | None) –

    Starting foreground color, or None.

  • background (ColorValue | Expression[ColorValue] | None) –

    Starting background color, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration of the fade in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • FadeFromEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • FadeFromEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def fade_from(
    self, **parameters: Unpack[FadeFromEffectArguments]
) -> FadeFromEffectCustomization:
    """
    Fade the colors in from ``foreground`` and ``background``.

    Keyword Args:
        foreground (ColorValue | Expression[ColorValue] | None): Starting foreground color, or ``None``.
        background (ColorValue | Expression[ColorValue] | None): Starting background color, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration of the fade in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'FadeFromEffectCustomization', self._start('effect.fade_from', parameters)
    )

paint

paint(**parameters: Unpack[PaintEffectArguments]) -> PaintEffectCustomization

Paint foreground and background over the colors.

Other Parameters:

  • foreground (ColorValue | Expression[ColorValue] | None) –

    Foreground color to paint, or None.

  • background (ColorValue | Expression[ColorValue] | None) –

    Background color to paint, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • PaintEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • PaintEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def paint(
    self, **parameters: Unpack[PaintEffectArguments]
) -> PaintEffectCustomization:
    """
    Paint ``foreground`` and ``background`` over the colors.

    Keyword Args:
        foreground (ColorValue | Expression[ColorValue] | None): Foreground color to paint, or ``None``.
        background (ColorValue | Expression[ColorValue] | None): Background color to paint, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('PaintEffectCustomization', self._start('effect.paint', parameters))

saturate

saturate(**parameters: Unpack[SaturateEffectArguments]) -> SaturateEffectCustomization

Make the colors more or less saturated.

Other Parameters:

  • foreground (float | Expression[int | float] | None) –

    Foreground saturation change, or None.

  • background (float | Expression[int | float] | None) –

    Background saturation change, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SaturateEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SaturateEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def saturate(
    self, **parameters: Unpack[SaturateEffectArguments]
) -> SaturateEffectCustomization:
    """
    Make the colors more or less saturated.

    Keyword Args:
        foreground (float | Expression[int | float] | None): Foreground saturation change, or ``None``.
        background (float | Expression[int | float] | None): Background saturation change, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'SaturateEffectCustomization', self._start('effect.saturate', parameters)
    )

lighten

lighten(**parameters: Unpack[LightenEffectArguments]) -> LightenEffectCustomization

Lighten the colors.

Other Parameters:

  • foreground (float | Expression[int | float] | None) –

    Foreground lightness increase, or None.

  • background (float | Expression[int | float] | None) –

    Background lightness increase, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • LightenEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • LightenEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def lighten(
    self, **parameters: Unpack[LightenEffectArguments]
) -> LightenEffectCustomization:
    """
    Lighten the colors.

    Keyword Args:
        foreground (float | Expression[int | float] | None): Foreground lightness increase, or ``None``.
        background (float | Expression[int | float] | None): Background lightness increase, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'LightenEffectCustomization', self._start('effect.lighten', parameters)
    )

darken

darken(**parameters: Unpack[DarkenEffectArguments]) -> DarkenEffectCustomization

Darken the colors.

Other Parameters:

  • foreground (float | Expression[int | float] | None) –

    Foreground darkness increase, or None.

  • background (float | Expression[int | float] | None) –

    Background darkness increase, or None.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • DarkenEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • DarkenEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def darken(
    self, **parameters: Unpack[DarkenEffectArguments]
) -> DarkenEffectCustomization:
    """
    Darken the colors.

    Keyword Args:
        foreground (float | Expression[int | float] | None): Foreground darkness increase, or ``None``.
        background (float | Expression[int | float] | None): Background darkness increase, or ``None``.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('DarkenEffectCustomization', self._start('effect.darken', parameters))

sweep_in

sweep_in(**parameters: Unpack[SweepInEffectArguments]) -> SweepInEffectCustomization

Reveal the content behind a sweep of color in direction.

Other Parameters:

  • direction (MotionDirection | Expression[str] | None) –

    Sweep direction (such as 'left_to_right').

  • gradient_length (int | Expression[int | float] | None) –

    Length of the sweep gradient in cells.

  • randomness (int | Expression[int | float] | None) –

    Random offset across rows or columns.

  • color (ColorValue | Expression[ColorValue] | None) –

    Starting sweep color.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SweepInEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SweepInEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def sweep_in(
    self, **parameters: Unpack[SweepInEffectArguments]
) -> SweepInEffectCustomization:
    """
    Reveal the content behind a sweep of ``color`` in ``direction``.

    Keyword Args:
        direction (MotionDirection | Expression[str] | None): Sweep direction (such as ``'left_to_right'``).
        gradient_length (int | Expression[int | float] | None): Length of the sweep gradient in cells.
        randomness (int | Expression[int | float] | None): Random offset across rows or columns.
        color (ColorValue | Expression[ColorValue] | None): Starting sweep color.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'SweepInEffectCustomization', self._start('effect.sweep_in', parameters)
    )

sweep_out

sweep_out(**parameters: Unpack[SweepOutEffectArguments]) -> SweepOutEffectCustomization

Hide the content behind a sweep of color in direction.

Other Parameters:

  • direction (MotionDirection | Expression[str] | None) –

    Sweep direction (such as 'left_to_right').

  • gradient_length (int | Expression[int | float] | None) –

    Length of the sweep gradient in cells.

  • randomness (int | Expression[int | float] | None) –

    Random offset across rows or columns.

  • color (ColorValue | Expression[ColorValue] | None) –

    Ending sweep color.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SweepOutEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SweepOutEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def sweep_out(
    self, **parameters: Unpack[SweepOutEffectArguments]
) -> SweepOutEffectCustomization:
    """
    Hide the content behind a sweep of ``color`` in ``direction``.

    Keyword Args:
        direction (MotionDirection | Expression[str] | None): Sweep direction (such as ``'left_to_right'``).
        gradient_length (int | Expression[int | float] | None): Length of the sweep gradient in cells.
        randomness (int | Expression[int | float] | None): Random offset across rows or columns.
        color (ColorValue | Expression[ColorValue] | None): Ending sweep color.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'SweepOutEffectCustomization', self._start('effect.sweep_out', parameters)
    )

slide_in

slide_in(**parameters: Unpack[SlideInEffectArguments]) -> SlideInEffectCustomization

Slide the content in, in direction.

Other Parameters:

  • direction (MotionDirection | Expression[str] | None) –

    Slide direction (such as 'left_to_right').

  • gradient_length (int | Expression[int | float] | None) –

    Length of the gradient trail in cells.

  • randomness (int | Expression[int | float] | None) –

    Random offset across rows or columns.

  • color (ColorValue | Expression[ColorValue] | None) –

    Color behind the sliding cells.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SlideInEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SlideInEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def slide_in(
    self, **parameters: Unpack[SlideInEffectArguments]
) -> SlideInEffectCustomization:
    """
    Slide the content in, in ``direction``.

    Keyword Args:
        direction (MotionDirection | Expression[str] | None): Slide direction (such as ``'left_to_right'``).
        gradient_length (int | Expression[int | float] | None): Length of the gradient trail in cells.
        randomness (int | Expression[int | float] | None): Random offset across rows or columns.
        color (ColorValue | Expression[ColorValue] | None): Color behind the sliding cells.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'SlideInEffectCustomization', self._start('effect.slide_in', parameters)
    )

slide_out

slide_out(**parameters: Unpack[SlideOutEffectArguments]) -> SlideOutEffectCustomization

Slide the content out, in direction.

Other Parameters:

  • direction (MotionDirection | Expression[str] | None) –

    Slide direction (such as 'left_to_right').

  • gradient_length (int | Expression[int | float] | None) –

    Length of the gradient trail in cells.

  • randomness (int | Expression[int | float] | None) –

    Random offset across rows or columns.

  • color (ColorValue | Expression[ColorValue] | None) –

    Color left behind the sliding cells.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SlideOutEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SlideOutEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def slide_out(
    self, **parameters: Unpack[SlideOutEffectArguments]
) -> SlideOutEffectCustomization:
    """
    Slide the content out, in ``direction``.

    Keyword Args:
        direction (MotionDirection | Expression[str] | None): Slide direction (such as ``'left_to_right'``).
        gradient_length (int | Expression[int | float] | None): Length of the gradient trail in cells.
        randomness (int | Expression[int | float] | None): Random offset across rows or columns.
        color (ColorValue | Expression[ColorValue] | None): Color left behind the sliding cells.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'SlideOutEffectCustomization', self._start('effect.slide_out', parameters)
    )

hsl_shift

hsl_shift(**parameters: Unpack[HslShiftEffectArguments]) -> HslShiftEffectCustomization

Shift the hue, saturation and lightness of the colors.

Other Parameters:

  • foreground (HslShiftTuple | None) –

    (hue, saturation, lightness) shift for foreground colors.

  • background (HslShiftTuple | None) –

    (hue, saturation, lightness) shift for background colors.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • HslShiftEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • HslShiftEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def hsl_shift(
    self, **parameters: Unpack[HslShiftEffectArguments]
) -> HslShiftEffectCustomization:
    """
    Shift the hue, saturation and lightness of the colors.

    Keyword Args:
        foreground (HslShiftTuple | None): ``(hue, saturation, lightness)`` shift for foreground colors.
        background (HslShiftTuple | None): ``(hue, saturation, lightness)`` shift for background colors.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'HslShiftEffectCustomization', self._start('effect.hsl_shift', parameters)
    )

dissolve

dissolve(**parameters: Unpack[DissolveEffectArguments]) -> DissolveEffectCustomization

Dissolve the content into style, cell by cell.

Other Parameters:

  • style (Style | DynamicStyle | None) –

    Style dissolved into.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • DissolveEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • DissolveEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def dissolve(
    self, **parameters: Unpack[DissolveEffectArguments]
) -> DissolveEffectCustomization:
    """
    Dissolve the content into ``style``, cell by cell.

    Keyword Args:
        style (Style | DynamicStyle | None): Style dissolved into.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'DissolveEffectCustomization', self._start('effect.dissolve', parameters)
    )

coalesce

coalesce(**parameters: Unpack[CoalesceEffectArguments]) -> CoalesceEffectCustomization

Bring the content together out of style, cell by cell.

Other Parameters:

  • style (Style | DynamicStyle | None) –

    Style coalesced from.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • CoalesceEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • CoalesceEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def coalesce(
    self, **parameters: Unpack[CoalesceEffectArguments]
) -> CoalesceEffectCustomization:
    """
    Bring the content together out of ``style``, cell by cell.

    Keyword Args:
        style (Style | DynamicStyle | None): Style coalesced from.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'CoalesceEffectCustomization', self._start('effect.coalesce', parameters)
    )

glitch

glitch(**parameters: Unpack[GlitchEffectArguments]) -> GlitchEffectCustomization

Make a share of the cells glitch for a moment.

Other Parameters:

  • ratio (float | Expression[int | float] | None) –

    Fraction of cells affected by the glitch.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • start_delay_milliseconds (tuple[int, int]) –

    (minimum, maximum) delay before a cell glitches.

  • action_milliseconds (tuple[int, int]) –

    (minimum, maximum) duration of each cell glitch.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • GlitchEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • GlitchEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def glitch(
    self, **parameters: Unpack[GlitchEffectArguments]
) -> GlitchEffectCustomization:
    """
    Make a share of the cells glitch for a moment.

    Keyword Args:
        ratio (float | Expression[int | float] | None): Fraction of cells affected by the glitch.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        start_delay_milliseconds (tuple[int, int]): ``(minimum, maximum)`` delay before a cell glitches.
        action_milliseconds (tuple[int, int]): ``(minimum, maximum)`` duration of each cell glitch.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('GlitchEffectCustomization', self._start('effect.glitch', parameters))

sleep

sleep(**parameters: Unpack[SleepEffectArguments]) -> SleepEffectCustomization

Wait for duration_milliseconds without changing anything.

Other Parameters:

  • duration_milliseconds (int | Expression[int | float]) –

    Pause duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • SleepEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • SleepEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def sleep(
    self, **parameters: Unpack[SleepEffectArguments]
) -> SleepEffectCustomization:
    """
    Wait for ``duration_milliseconds`` without changing anything.

    Keyword Args:
        duration_milliseconds (int | Expression[int | float]): Pause duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('SleepEffectCustomization', self._start('effect.sleep', parameters))

evolve

evolve(**parameters: Unpack[EvolveEffectArguments]) -> EvolveEffectCustomization

Cycle the cells through a progression of symbols.

Other Parameters:

  • symbols (EvolveSymbolSet | Expression[str] | None) –

    The symbols stepped through, such as 'circles', 'squares' or 'shaded'.

  • style (Style | DynamicStyle | None) –

    Optional style applied to the evolving symbols.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • EvolveEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • EvolveEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def evolve(
    self, **parameters: Unpack[EvolveEffectArguments]
) -> EvolveEffectCustomization:
    """
    Cycle the cells through a progression of ``symbols``.

    Keyword Args:
        symbols (EvolveSymbolSet | Expression[str] | None): The symbols stepped through, such as ``'circles'``, ``'squares'`` or ``'shaded'``.
        style (Style | DynamicStyle | None): Optional style applied to the evolving symbols.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('EvolveEffectCustomization', self._start('effect.evolve', parameters))

evolve_into

evolve_into(**parameters: Unpack[EvolveIntoEffectArguments]) -> EvolveIntoEffectCustomization

Turn the content into a progression of symbols.

Other Parameters:

  • symbols (EvolveSymbolSet | Expression[str] | None) –

    The symbols stepped through, such as 'circles', 'squares' or 'shaded'.

  • style (Style | DynamicStyle | None) –

    Optional style applied to the evolving symbols.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • EvolveIntoEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • EvolveIntoEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def evolve_into(
    self, **parameters: Unpack[EvolveIntoEffectArguments]
) -> EvolveIntoEffectCustomization:
    """
    Turn the content into a progression of ``symbols``.

    Keyword Args:
        symbols (EvolveSymbolSet | Expression[str] | None): The symbols stepped through, such as ``'circles'``, ``'squares'`` or ``'shaded'``.
        style (Style | DynamicStyle | None): Optional style applied to the evolving symbols.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'EvolveIntoEffectCustomization', self._start('effect.evolve_into', parameters)
    )

evolve_from

evolve_from(**parameters: Unpack[EvolveFromEffectArguments]) -> EvolveFromEffectCustomization

Grow the content out of a progression of symbols.

Other Parameters:

  • symbols (EvolveSymbolSet | Expression[str] | None) –

    The symbols stepped through, such as 'circles', 'squares' or 'shaded'.

  • style (Style | DynamicStyle | None) –

    Optional style applied to the evolving symbols.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • EvolveFromEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • EvolveFromEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def evolve_from(
    self, **parameters: Unpack[EvolveFromEffectArguments]
) -> EvolveFromEffectCustomization:
    """
    Grow the content out of a progression of ``symbols``.

    Keyword Args:
        symbols (EvolveSymbolSet | Expression[str] | None): The symbols stepped through, such as ``'circles'``, ``'squares'`` or ``'shaded'``.
        style (Style | DynamicStyle | None): Optional style applied to the evolving symbols.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'EvolveFromEffectCustomization', self._start('effect.evolve_from', parameters)
    )

expand

expand(**parameters: Unpack[ExpandEffectArguments]) -> ExpandEffectCustomization

Expand style outward from the center.

Other Parameters:

  • direction (Literal['horizontal', 'vertical'] | Expression[str] | None) –

    'horizontal' or 'vertical'.

  • style (Style | DynamicStyle | None) –

    Style expanded outward from the center.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • ExpandEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • ExpandEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def expand(
    self, **parameters: Unpack[ExpandEffectArguments]
) -> ExpandEffectCustomization:
    """
    Expand ``style`` outward from the center.

    Keyword Args:
        direction (Literal['horizontal', 'vertical'] | Expression[str] | None): ``'horizontal'`` or ``'vertical'``.
        style (Style | DynamicStyle | None): Style expanded outward from the center.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast('ExpandEffectCustomization', self._start('effect.expand', parameters))

stretch

stretch(**parameters: Unpack[StretchEffectArguments]) -> StretchEffectCustomization

Stretch style across the area in direction.

Other Parameters:

  • direction (MotionDirection | Expression[str] | None) –

    'left_to_right', 'right_to_left', 'up_to_down' or 'down_to_up'.

  • style (Style | DynamicStyle | None) –

    Style stretched across the area.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • StretchEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • StretchEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def stretch(
    self, **parameters: Unpack[StretchEffectArguments]
) -> StretchEffectCustomization:
    """
    Stretch ``style`` across the area in ``direction``.

    Keyword Args:
        direction (MotionDirection | Expression[str] | None): ``'left_to_right'``, ``'right_to_left'``, ``'up_to_down'`` or ``'down_to_up'``.
        style (Style | DynamicStyle | None): Style stretched across the area.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'StretchEffectCustomization', self._start('effect.stretch', parameters)
    )

explode

explode(**parameters: Unpack[ExplodeEffectArguments]) -> ExplodeEffectCustomization

Throw the cells outward.

Other Parameters:

  • force (float | Expression[int | float] | None) –

    Outward force throwing the cells.

  • randomness (float | Expression[int | float] | None) –

    Variation in force from cell to cell.

  • duration_milliseconds (int | Expression[int | float] | None) –

    Duration in milliseconds.

  • interpolation (Interpolation | Expression[str] | None) –

    The easing curve, such as 'linear' or 'quad_in_out'.

  • key (str | Expression[str] | None) –

    Optional effect key for replacement or cancellation.

Returns:

  • ExplodeEffectCustomization –

    The running effect. Assigning one of its fields starts it again with the new

  • ExplodeEffectCustomization –

    values, and cancel() stops it.

Source code in xnano/_effect_controller.py
def explode(
    self, **parameters: Unpack[ExplodeEffectArguments]
) -> ExplodeEffectCustomization:
    """
    Throw the cells outward.

    Keyword Args:
        force (float | Expression[int | float] | None): Outward force throwing the cells.
        randomness (float | Expression[int | float] | None): Variation in force from cell to cell.
        duration_milliseconds (int | Expression[int | float] | None): Duration in milliseconds.
        interpolation (Interpolation | Expression[str] | None): The easing curve, such as ``'linear'`` or ``'quad_in_out'``.
        key (str | Expression[str] | None): Optional effect key for replacement or cancellation.

    Returns:
        The running effect. Assigning one of its fields starts it again with the new
        values, and ``cancel()`` stops it.
    """
    return cast(
        'ExplodeEffectCustomization', self._start('effect.explode', parameters)
    )

clear

clear() -> None

Stop every effect started here. Does nothing when none was started.

Source code in xnano/_effect_controller.py
def clear(self) -> None:
    """Stop every effect started here. Does nothing when none was started."""
    running = tuple(self._running.values())
    self._running.clear()
    for effect in running:
        effect.cancel()

HookHandle

HookHandle(owner: _Hooked[DepsT, StateT], function: Callable[[Context[DepsT, StateT]], object], *, on: HookKind | None, when: CompiledWhen, every: float | None, after: float | None, keys: tuple[str, ...])

Bases: Generic[DepsT, StateT]

One hook attached to a canvas or a placement.

remove stops the hook, cancels its timer and closes its generator.

Attributes:

Attach a function to a canvas or placement. Use hook instead of calling this.

Parameters:

  • owner (_Hooked[DepsT, StateT]) –

    The canvas or placement the hook listens on.

  • function (Callable[[Context[DepsT, StateT]], object]) –

    The function to call with a Context.

  • on (HookKind | None) –

    When the hook runs.

  • when (CompiledWhen) –

    The compiled condition.

  • every (float | None) –

    Seconds ('tick') or beats ('beat') between runs.

  • after (float | None) –

    Seconds or beats before the one run.

  • keys (tuple[str, ...]) –

    The normalized keys of an on='key' hook.

Methods:

  • remove –

    Stop this hook. Removing it twice does nothing.

Source code in xnano/_hooks.py
def __init__(
    self,
    owner: _Hooked[DepsT, StateT],
    function: Callable[[Context[DepsT, StateT]], object],
    *,
    on: HookKind | None,
    when: CompiledWhen,
    every: float | None,
    after: float | None,
    keys: tuple[str, ...],
) -> None:
    """
    Attach a function to a canvas or placement. Use ``hook`` instead of calling this.

    Args:
        owner: The canvas or placement the hook listens on.
        function: The function to call with a [`Context`][xnano.context.Context].
        on: When the hook runs.
        when: The compiled condition.
        every: Seconds (``'tick'``) or beats (``'beat'``) between runs.
        after: Seconds or beats before the one run.
        keys: The normalized keys of an ``on='key'`` hook.
    """
    self._owner = owner
    self.function = function
    self.on = on
    self._when = when
    self._every = every
    self._after = after
    self._keys = keys
    self._removed = False
    self._is_generator_function = inspect.isgeneratorfunction(function)
    self._generator: Generator[None, Context[DepsT, StateT], None] | None = None
    self._core_hook: _core.Hook | None = None
    self._registration: _Registration | None = None
    self._stop_frames: Callable[[], None] | None = None
    self._due: float | None = None
    self._is_captured = False
    self._own_revisions: deque[int] = deque(maxlen=4)
    self._state_run: _HookRun = _HookRun(track=on == 'state')
    self._followed: frozenset[tuple[str | int, ...]] | None = None
    self._plugin_state: StateNamespace | None = None
    self._effect_state: EffectState | None = None

function instance-attribute

function: Callable[[Context[DepsT, StateT]], object] = function

The function called with a context when an event counts.

on instance-attribute

on: HookKind | None = on

When the hook runs, or None for a hook that hears every input event.

is_removed property

is_removed: bool

Whether remove was called.

remove

remove() -> None

Stop this hook. Removing it twice does nothing.

Source code in xnano/_hooks.py
def remove(self) -> None:
    """Stop this hook. Removing it twice does nothing."""
    if self._removed:
        return
    self._removed = True
    effect_state = self._effect_state
    if effect_state is not None:
        self._effect_state = None
        effect_state.clear()
    generator = self._generator
    self._generator = None
    if generator is not None and inspect.getgeneratorstate(generator) != (
        inspect.GEN_RUNNING
    ):
        generator.close()
    registrations = self._owner._registrations
    if self in registrations:
        registrations.remove(self)
    owner = self._owner
    owner._canvas._host.post(self._unregister)

SupportsPlay

Bases: Protocol[DepsT_contra, StateT_contra]

Anything that can be played: an object with a __xnano_play__ method.

The method receives the Context and returns what to play. No base class is needed; a dataclass or a plain class qualifies. The context may be annotated with the dependency and state types the component reads, such as Context[Services].

Methods:

__xnano_play__

__xnano_play__(context: Context[DepsT_contra, StateT_contra]) -> Playable

Return what to play.

Source code in xnano/_values.py
def __xnano_play__(self, context: Context[DepsT_contra, StateT_contra]) -> Playable:
    """Return what to play."""
    ...

SupportsRender

Bases: Protocol[DepsT_contra, StateT_contra]

Anything that draws itself: an object with a __xnano_render__ method.

The method receives the Context and returns what to draw, which is any Renderable. No base class is needed; a dataclass or a plain class qualifies. The context may be annotated with the dependency and state types the component reads, such as Context[Services]. The method runs again, on the next frame, only when it read something that changes (the time, the size, state or an input).

Methods:

__xnano_render__

__xnano_render__(context: Context[DepsT_contra, StateT_contra]) -> Renderable

Return what to draw.

Source code in xnano/_values.py
def __xnano_render__(
    self, context: Context[DepsT_contra, StateT_contra]
) -> Renderable:
    """Return what to draw."""
    ...

GateSettings

Bases: TypedDict

What a screen reports to a canvas: the input gates of new() and open().

A canvas stores the gates it is given and applies them when it is opened on a screen; a canvas without a screen has no device to report anything, and events pushed with Canvas.push reach hooks whatever the gates say. A gate that is left out takes its default. mouse, scroll and paste are turned on when the canvas is opened if a hook registered before that needs them; a gate given as False stays off, and a hook that needs it raises a TerminalError that says which gate to turn on.

Attributes:

  • mouse (bool | Literal['motion']) –

    True reports button presses, releases and drags; 'motion' reports every movement as well. Unset by default: turned on when a hook registered before the canvas is opened needs it. The wheel is the scroll gate.

  • scroll (bool) –

    Whether the mouse wheel is reported. Unset by default: turned on when a hook registered before the canvas is opened needs it.

  • keyboard (bool | Literal['disambiguated', 'release_events']) –

    True for ordinary key presses, 'disambiguated' to tell keys such as escape and alt+key apart, 'release_events' to also report repeats and releases, and False to ignore keys. True by default.

  • paste (bool) –

    Whether pasted text arrives as one paste event instead of as key presses. Unset by default, which means on.

  • focus (bool) –

    Whether the window gaining and losing focus is reported. On by default.

  • interrupt (bool) –

    Whether Ctrl-C ends the loop. False delivers it as a key press. On by default.

  • capture (bool) –

    Whether text printed while the screen is in use is held back and printed when the canvas closes. On by default.

  • clear (bool) –

    Whether what was drawn is erased when the canvas closes. On by default.

  • alternate_screen (bool) –

    Whether a full-window canvas draws on the alternate screen, so the shell's history comes back untouched. On by default.

mouse instance-attribute

mouse: bool | Literal['motion']

True for presses, releases and drags; 'motion' for every movement too.

scroll instance-attribute

scroll: bool

Whether the mouse wheel is reported.

keyboard instance-attribute

keyboard: bool | Literal['disambiguated', 'release_events']

Which key events are reported, or False for none.

paste instance-attribute

paste: bool

Whether pasted text arrives as one paste event.

focus instance-attribute

focus: bool

Whether the window gaining and losing focus is reported.

interrupt instance-attribute

interrupt: bool

Whether Ctrl-C ends the loop.

capture instance-attribute

capture: bool

Whether printed text is held back while the screen is in use.

clear instance-attribute

clear: bool

Whether what was drawn is erased when the canvas closes.

alternate_screen instance-attribute

alternate_screen: bool

Whether a full-window canvas draws on the alternate screen.

CanvasAppearanceArguments

Bases: TypedDict

How a canvas itself looks: its colors, text modifiers, border, padding and margin.

These style the canvas, not what is written into it, so new() and open() accept them only without content. title is not one of them: on new() and open() it is the window title.

Attributes:

style instance-attribute

style: Style | None

A ready-made style that the colors and modifiers are applied over.

foreground instance-attribute

foreground: ColorValue | None

The foreground color.

background instance-attribute

background: ColorValue | None

The background color.

bold instance-attribute

bold: bool

Whether the cells are bold.

dim instance-attribute

dim: bool

Whether the cells are dimmed.

italic instance-attribute

italic: bool

Whether the cells are italic.

underline instance-attribute

underline: bool

Whether the cells are underlined.

blink: bool

Whether the cells blink.

reverse instance-attribute

reverse: bool

Whether foreground and background are swapped.

hidden instance-attribute

hidden: bool

Whether the cells are hidden.

crossed_out instance-attribute

crossed_out: bool

Whether the cells are struck through.

border instance-attribute

border: BorderKind | bool | None

The kind of border; True is 'plain' and False is none.

border_style instance-attribute

border_style: Style | None

The style of the border.

padding instance-attribute

padding: Spacing | None

Space between the border and the content.

margin instance-attribute

margin: Spacing | None

Space outside the border.

AppearanceArguments

Bases: CanvasAppearanceArguments

How written content looks: the appearance keywords of write.

Attributes:

  • title (str | None) –

    A title on the border of the content.

title instance-attribute

title: str | None

A title on the border.

style instance-attribute

style: Style | None

A ready-made style that the colors and modifiers are applied over.

foreground instance-attribute

foreground: ColorValue | None

The foreground color.

background instance-attribute

background: ColorValue | None

The background color.

bold instance-attribute

bold: bool

Whether the cells are bold.

dim instance-attribute

dim: bool

Whether the cells are dimmed.

italic instance-attribute

italic: bool

Whether the cells are italic.

underline instance-attribute

underline: bool

Whether the cells are underlined.

blink: bool

Whether the cells blink.

reverse instance-attribute

reverse: bool

Whether foreground and background are swapped.

hidden instance-attribute

hidden: bool

Whether the cells are hidden.

crossed_out instance-attribute

crossed_out: bool

Whether the cells are struck through.

border instance-attribute

border: BorderKind | bool | None

The kind of border; True is 'plain' and False is none.

border_style instance-attribute

border_style: Style | None

The style of the border.

padding instance-attribute

padding: Spacing | None

Space between the border and the content.

margin instance-attribute

margin: Spacing | None

Space outside the border.

CanvasSettings

Bases: GateSettings, CanvasAppearanceArguments

The keyword settings of new: the input gates and the canvas's own look.

Every key is described where it is declared, in GateSettings and CanvasAppearanceArguments.

Attributes:

layout instance-attribute

layout: CanvasLayout

How the canvas places what is written on it.

edges instance-attribute

edges: EdgeBehavior

What content does at the edges of its area.

style instance-attribute

style: Style | None

A ready-made style that the colors and modifiers are applied over.

foreground instance-attribute

foreground: ColorValue | None

The foreground color.

background instance-attribute

background: ColorValue | None

The background color.

bold instance-attribute

bold: bool

Whether the cells are bold.

dim instance-attribute

dim: bool

Whether the cells are dimmed.

italic instance-attribute

italic: bool

Whether the cells are italic.

underline instance-attribute

underline: bool

Whether the cells are underlined.

blink: bool

Whether the cells blink.

reverse instance-attribute

reverse: bool

Whether foreground and background are swapped.

hidden instance-attribute

hidden: bool

Whether the cells are hidden.

crossed_out instance-attribute

crossed_out: bool

Whether the cells are struck through.

border instance-attribute

border: BorderKind | bool | None

The kind of border; True is 'plain' and False is none.

border_style instance-attribute

border_style: Style | None

The style of the border.

padding instance-attribute

padding: Spacing | None

Space between the border and the content.

margin instance-attribute

margin: Spacing | None

Space outside the border.

mouse instance-attribute

mouse: bool | Literal['motion']

True for presses, releases and drags; 'motion' for every movement too.

scroll instance-attribute

scroll: bool

Whether the mouse wheel is reported.

keyboard instance-attribute

keyboard: bool | Literal['disambiguated', 'release_events']

Which key events are reported, or False for none.

paste instance-attribute

paste: bool

Whether pasted text arrives as one paste event.

focus instance-attribute

focus: bool

Whether the window gaining and losing focus is reported.

interrupt instance-attribute

interrupt: bool

Whether Ctrl-C ends the loop.

capture instance-attribute

capture: bool

Whether printed text is held back while the screen is in use.

clear instance-attribute

clear: bool

Whether what was drawn is erased when the canvas closes.

alternate_screen instance-attribute

alternate_screen: bool

Whether a full-window canvas draws on the alternate screen.

OpenSettings

Bases: CanvasSettings

The keyword settings of Canvas.open and of open given a canvas.

Everything new() takes except realtime (a screen always runs in real time) and the content. deps and state are accepted only by a canvas created without them.

Attributes:

fps instance-attribute

fps: float

The most frames drawn per second.

bpm instance-attribute

bpm: float

Beats per minute.

effects instance-attribute

Effects to apply, as dictionaries with a kind key.

deps instance-attribute

deps: object

The dependencies hooks read as context.deps.

state instance-attribute

state: object

A dataclass instance the canvas keeps and validates.

style instance-attribute

style: Style | None

A ready-made style that the colors and modifiers are applied over.

foreground instance-attribute

foreground: ColorValue | None

The foreground color.

background instance-attribute

background: ColorValue | None

The background color.

bold instance-attribute

bold: bool

Whether the cells are bold.

dim instance-attribute

dim: bool

Whether the cells are dimmed.

italic instance-attribute

italic: bool

Whether the cells are italic.

underline instance-attribute

underline: bool

Whether the cells are underlined.

blink: bool

Whether the cells blink.

reverse instance-attribute

reverse: bool

Whether foreground and background are swapped.

hidden instance-attribute

hidden: bool

Whether the cells are hidden.

crossed_out instance-attribute

crossed_out: bool

Whether the cells are struck through.

border instance-attribute

border: BorderKind | bool | None

The kind of border; True is 'plain' and False is none.

border_style instance-attribute

border_style: Style | None

The style of the border.

padding instance-attribute

padding: Spacing | None

Space between the border and the content.

margin instance-attribute

margin: Spacing | None

Space outside the border.

mouse instance-attribute

mouse: bool | Literal['motion']

True for presses, releases and drags; 'motion' for every movement too.

scroll instance-attribute

scroll: bool

Whether the mouse wheel is reported.

keyboard instance-attribute

keyboard: bool | Literal['disambiguated', 'release_events']

Which key events are reported, or False for none.

paste instance-attribute

paste: bool

Whether pasted text arrives as one paste event.

focus instance-attribute

focus: bool

Whether the window gaining and losing focus is reported.

interrupt instance-attribute

interrupt: bool

Whether Ctrl-C ends the loop.

capture instance-attribute

capture: bool

Whether printed text is held back while the screen is in use.

clear instance-attribute

clear: bool

Whether what was drawn is erased when the canvas closes.

alternate_screen instance-attribute

alternate_screen: bool

Whether a full-window canvas draws on the alternate screen.

layout instance-attribute

layout: CanvasLayout

How the canvas places what is written on it.

edges instance-attribute

edges: EdgeBehavior

What content does at the edges of its area.

PlayOptions

Bases: TypedDict

The keyword options of play. An option replaces the same value on a Note.

Attributes:

instrument instance-attribute

instrument: InstrumentName

A built-in instrument name.

velocity instance-attribute

velocity: float

How hard a note is played.

effects instance-attribute

Sound effects as dictionaries with a kind key.

volume instance-attribute

volume: float

Playback gain.

pan instance-attribute

pan: float

Stereo position.

at_beat instance-attribute

at_beat: int

The beat of the musical clock to start on.

beats instance-attribute

beats: float

The length in beats.