xnano.effects
xnano.effects
¶
xnano.effects
Effects: how content changes over time, in how it looks or how it sounds.
effect builds the parameters of a visual effect (a kind that starts
with 'effect.', such as 'effect.fade_to') or a sound effect (a kind that starts with
'audio.', such as 'audio.reverb'). The result is applied with |, update, a
hook that returns it, or an effects=[...] list, and assigning one of its fields changes
the effect while it runs.
The .fx properties of placements, canvases, canvas.speaker and context start an effect
by name instead: placement.fx.fade_to(...), canvas.speaker.fx.reverb(...) and
context.fx.fade_to(...). An effects=[...] list takes each effect as a dictionary with
its kind, such as {'kind': 'effect.fade_to', 'foreground': 'red'}.
Effect.fade_to(...) in xnano.operations is the operation form of
effect('effect.fade_to', ...).
Classes:
-
BitCrushAudioEffectParametersSchema–The keyword arguments of
effect('audio.bit_crush', ...). -
BitCrushAudioEffectSpecification–The dictionary form of the
'audio.bit_crush'sound effect ineffects=[...]. -
CoalesceEffectParametersSchema–The keyword arguments of
effect('effect.coalesce', ...). -
CoalesceEffectSpecification–The dictionary form of the
'effect.coalesce'visual effect ineffects=[...]. -
DarkenEffectParametersSchema–The keyword arguments of
effect('effect.darken', ...). -
DarkenEffectSpecification–The dictionary form of the
'effect.darken'visual effect ineffects=[...]. -
DelayAudioEffectParametersSchema–The keyword arguments of
effect('audio.delay', ...). -
DelayAudioEffectSpecification–The dictionary form of the
'audio.delay'sound effect ineffects=[...]. -
DissolveEffectParametersSchema–The keyword arguments of
effect('effect.dissolve', ...). -
DissolveEffectSpecification–The dictionary form of the
'effect.dissolve'visual effect ineffects=[...]. -
DistortionAudioEffectParametersSchema–The keyword arguments of
effect('audio.distortion', ...). -
DistortionAudioEffectSpecification–The dictionary form of the
'audio.distortion'sound effect ineffects=[...]. -
EvolveEffectParametersSchema–The keyword arguments of
effect('effect.evolve', ...). -
EvolveEffectSpecification–The dictionary form of the
'effect.evolve'visual effect ineffects=[...]. -
EvolveFromEffectParametersSchema–The keyword arguments of
effect('effect.evolve_from', ...). -
EvolveFromEffectSpecification–The dictionary form of the
'effect.evolve_from'visual effect ineffects=[...]. -
EvolveIntoEffectParametersSchema–The keyword arguments of
effect('effect.evolve_into', ...). -
EvolveIntoEffectSpecification–The dictionary form of the
'effect.evolve_into'visual effect ineffects=[...]. -
ExpandEffectParametersSchema–The keyword arguments of
effect('effect.expand', ...). -
ExpandEffectSpecification–The dictionary form of the
'effect.expand'visual effect ineffects=[...]. -
ExplodeEffectParametersSchema–The keyword arguments of
effect('effect.explode', ...). -
ExplodeEffectSpecification–The dictionary form of the
'effect.explode'visual effect ineffects=[...]. -
FadeFromEffectParametersSchema–The keyword arguments of
effect('effect.fade_from', ...). -
FadeFromEffectSpecification–The dictionary form of the
'effect.fade_from'visual effect ineffects=[...]. -
FadeToEffectParametersSchema–The keyword arguments of
effect('effect.fade_to', ...). -
FadeToEffectSpecification–The dictionary form of the
'effect.fade_to'visual effect ineffects=[...]. -
GlitchEffectParametersSchema–The keyword arguments of
effect('effect.glitch', ...). -
GlitchEffectSpecification–The dictionary form of the
'effect.glitch'visual effect ineffects=[...]. -
HighPassAudioEffectParametersSchema–The keyword arguments of
effect('audio.high_pass', ...). -
HighPassAudioEffectSpecification–The dictionary form of the
'audio.high_pass'sound effect ineffects=[...]. -
HslShiftEffectParametersSchema–The keyword arguments of
effect('effect.hsl_shift', ...). -
HslShiftEffectSpecification–The dictionary form of the
'effect.hsl_shift'visual effect ineffects=[...]. -
LightenEffectParametersSchema–The keyword arguments of
effect('effect.lighten', ...). -
LightenEffectSpecification–The dictionary form of the
'effect.lighten'visual effect ineffects=[...]. -
LowPassAudioEffectParametersSchema–The keyword arguments of
effect('audio.low_pass', ...). -
LowPassAudioEffectSpecification–The dictionary form of the
'audio.low_pass'sound effect ineffects=[...]. -
PaintEffectParametersSchema–The keyword arguments of
effect('effect.paint', ...). -
PaintEffectSpecification–The dictionary form of the
'effect.paint'visual effect ineffects=[...]. -
ReverbAudioEffectParametersSchema–The keyword arguments of
effect('audio.reverb', ...). -
ReverbAudioEffectSpecification–The dictionary form of the
'audio.reverb'sound effect ineffects=[...]. -
SaturateEffectParametersSchema–The keyword arguments of
effect('effect.saturate', ...). -
SaturateEffectSpecification–The dictionary form of the
'effect.saturate'visual effect ineffects=[...]. -
SleepEffectParametersSchema–The keyword arguments of
effect('effect.sleep', ...). -
SleepEffectSpecification–The dictionary form of the
'effect.sleep'visual effect ineffects=[...]. -
SlideInEffectParametersSchema–The keyword arguments of
effect('effect.slide_in', ...). -
SlideInEffectSpecification–The dictionary form of the
'effect.slide_in'visual effect ineffects=[...]. -
SlideOutEffectParametersSchema–The keyword arguments of
effect('effect.slide_out', ...). -
SlideOutEffectSpecification–The dictionary form of the
'effect.slide_out'visual effect ineffects=[...]. -
StretchEffectParametersSchema–The keyword arguments of
effect('effect.stretch', ...). -
StretchEffectSpecification–The dictionary form of the
'effect.stretch'visual effect ineffects=[...]. -
SweepInEffectParametersSchema–The keyword arguments of
effect('effect.sweep_in', ...). -
SweepInEffectSpecification–The dictionary form of the
'effect.sweep_in'visual effect ineffects=[...]. -
SweepOutEffectParametersSchema–The keyword arguments of
effect('effect.sweep_out', ...). -
SweepOutEffectSpecification–The dictionary form of the
'effect.sweep_out'visual effect ineffects=[...]. -
TremoloAudioEffectParametersSchema–The keyword arguments of
effect('audio.tremolo', ...). -
TremoloAudioEffectSpecification–The dictionary form of the
'audio.tremolo'sound effect ineffects=[...]. -
EffectController–The effects of the hook that is running, one method for each effect.
-
AudioEffectParameters–The base of the parameters of every sound effect (
'audio.<name>'). -
BitCrushAudioEffectParameters–The parameters of the
'audio.bit_crush'sound effect. -
CoalesceEffectParameters–The parameters of the
'effect.coalesce'visual effect (Effect.coalesce). -
DarkenEffectParameters–The parameters of the
'effect.darken'visual effect (Effect.darken). -
DelayAudioEffectParameters–The parameters of the
'audio.delay'sound effect. -
DissolveEffectParameters–The parameters of the
'effect.dissolve'visual effect (Effect.dissolve). -
DistortionAudioEffectParameters–The parameters of the
'audio.distortion'sound effect. -
EffectParameters–The base of the parameters of every effect that
effectreturns. -
EvolveEffectParameters–The parameters of the
'effect.evolve'visual effect (Effect.evolve). -
EvolveFromEffectParameters–The parameters of the
'effect.evolve_from'visual effect (Effect.evolve_from). -
EvolveIntoEffectParameters–The parameters of the
'effect.evolve_into'visual effect (Effect.evolve_into). -
ExpandEffectParameters–The parameters of the
'effect.expand'visual effect (Effect.expand). -
ExplodeEffectParameters–The parameters of the
'effect.explode'visual effect (Effect.explode). -
FadeFromEffectParameters–The parameters of the
'effect.fade_from'visual effect (Effect.fade_from). -
FadeToEffectParameters–The parameters of the
'effect.fade_to'visual effect (Effect.fade_to). -
GlitchEffectParameters–The parameters of the
'effect.glitch'visual effect (Effect.glitch). -
HighPassAudioEffectParameters–The parameters of the
'audio.high_pass'sound effect. -
HslShiftEffectParameters–The parameters of the
'effect.hsl_shift'visual effect (Effect.hsl_shift). -
LightenEffectParameters–The parameters of the
'effect.lighten'visual effect (Effect.lighten). -
LowPassAudioEffectParameters–The parameters of the
'audio.low_pass'sound effect. -
PaintEffectParameters–The parameters of the
'effect.paint'visual effect (Effect.paint). -
PlayableEffectProperties–The sound effects of a canvas's audio, one method for each effect.
-
ReverbAudioEffectParameters–The parameters of the
'audio.reverb'sound effect. -
SaturateEffectParameters–The parameters of the
'effect.saturate'visual effect (Effect.saturate). -
SleepEffectParameters–The parameters of the
'effect.sleep'visual effect (Effect.sleep). -
SlideInEffectParameters–The parameters of the
'effect.slide_in'visual effect (Effect.slide_in). -
SlideOutEffectParameters–The parameters of the
'effect.slide_out'visual effect (Effect.slide_out). -
StretchEffectParameters–The parameters of the
'effect.stretch'visual effect (Effect.stretch). -
SweepInEffectParameters–The parameters of the
'effect.sweep_in'visual effect (Effect.sweep_in). -
SweepOutEffectParameters–The parameters of the
'effect.sweep_out'visual effect (Effect.sweep_out). -
TremoloAudioEffectParameters–The parameters of the
'audio.tremolo'sound effect. -
WritableEffectProperties–The visual effects of a placement or a canvas, one method for each effect.
Functions:
-
effect–Create the parameters of a visual or sound effect.
Attributes:
-
EffectKind(TypeAlias) –Every kind of effect that
effect(kind, ...)accepts: the visual kinds and the sound kinds. -
EffectSpecification(TypeAlias) –Any visual or sound effect, as
effectreturns it. -
PlayableEffect(TypeAlias) –A sound effect as
effect(...)and the methods ofcanvas.speaker.fxandcontext.fxreturn it. -
PlayableEffectKind(TypeAlias) –The kinds of effect that change how a sound plays.
-
PlayableEffectSpecification(TypeAlias) –One sound effect as a dictionary for
effects=[...]: itskindand its keywords. -
WritableEffect(TypeAlias) –A visual effect as
effect(...)and the methods ofplacement.fxandcontext.fxreturn it. -
WritableEffectKind(TypeAlias) –The kinds of effect that change how a buffer looks.
-
WritableEffectSpecification(TypeAlias) –One visual effect as a dictionary for
effects=[...]: itskindand its keywords. -
Interpolation(TypeAlias) –How an effect eases between its start and end:
'linear', or a curve such as -
MotionDirection(TypeAlias) –The direction a sweep, slide or stretch effect moves in.
EffectKind
module-attribute
¶
EffectKind: TypeAlias = Literal[WritableEffectKind, PlayableEffectKind]
Every kind of effect that effect(kind, ...) accepts: the visual kinds and the sound kinds.
EffectSpecification
module-attribute
¶
EffectSpecification: TypeAlias = WritableEffect | PlayableEffect
PlayableEffect
module-attribute
¶
PlayableEffect: TypeAlias = BitCrushAudioEffectParameters | DistortionAudioEffectParameters | LowPassAudioEffectParameters | HighPassAudioEffectParameters | DelayAudioEffectParameters | ReverbAudioEffectParameters | TremoloAudioEffectParameters
A sound effect as effect(...) and the methods of canvas.speaker.fx and context.fx return it.
PlayableEffectKind
module-attribute
¶
PlayableEffectKind: TypeAlias = 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.
They are the kinds of effect that start with 'audio.', such as 'audio.reverb'.
PlayableEffectSpecification
module-attribute
¶
PlayableEffectSpecification: TypeAlias = BitCrushAudioEffectSpecification | DistortionAudioEffectSpecification | LowPassAudioEffectSpecification | HighPassAudioEffectSpecification | DelayAudioEffectSpecification | ReverbAudioEffectSpecification | TremoloAudioEffectSpecification
One sound effect as a dictionary for effects=[...]: its kind and its keywords.
WritableEffect
module-attribute
¶
WritableEffect: TypeAlias = FadeToEffectParameters | FadeFromEffectParameters | PaintEffectParameters | SaturateEffectParameters | LightenEffectParameters | DarkenEffectParameters | SweepInEffectParameters | SweepOutEffectParameters | SlideInEffectParameters | SlideOutEffectParameters | HslShiftEffectParameters | DissolveEffectParameters | CoalesceEffectParameters | GlitchEffectParameters | SleepEffectParameters | EvolveEffectParameters | EvolveIntoEffectParameters | EvolveFromEffectParameters | ExpandEffectParameters | StretchEffectParameters | ExplodeEffectParameters
A visual effect as effect(...) and the methods of placement.fx and context.fx return it.
WritableEffectKind
module-attribute
¶
WritableEffectKind: TypeAlias = 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.
They are the kinds of effect that start with 'effect.', such as 'effect.fade_to'.
WritableEffectSpecification
module-attribute
¶
WritableEffectSpecification: TypeAlias = FadeToEffectSpecification | FadeFromEffectSpecification | PaintEffectSpecification | SaturateEffectSpecification | LightenEffectSpecification | DarkenEffectSpecification | SweepInEffectSpecification | SweepOutEffectSpecification | SlideInEffectSpecification | SlideOutEffectSpecification | HslShiftEffectSpecification | DissolveEffectSpecification | CoalesceEffectSpecification | GlitchEffectSpecification | SleepEffectSpecification | EvolveEffectSpecification | EvolveIntoEffectSpecification | EvolveFromEffectSpecification | ExpandEffectSpecification | StretchEffectSpecification | ExplodeEffectSpecification
One visual effect as a dictionary for effects=[...]: its kind and its keywords.
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'.
-
API Reference
xnano
xnano.effects
effects-
CoalesceEffectParametersinterpolation -
CoalesceEffectParametersSchemainterpolation -
CoalesceEffectSpecificationinterpolation -
DarkenEffectParametersinterpolation -
DarkenEffectParametersSchemainterpolation -
DarkenEffectSpecificationinterpolation -
DissolveEffectParametersinterpolation -
DissolveEffectParametersSchemainterpolation -
DissolveEffectSpecificationinterpolation -
EvolveEffectParametersinterpolation -
EvolveEffectParametersSchemainterpolation -
EvolveEffectSpecificationinterpolation -
EvolveFromEffectParametersinterpolation -
EvolveFromEffectParametersSchemainterpolation -
EvolveFromEffectSpecificationinterpolation -
EvolveIntoEffectParametersinterpolation -
EvolveIntoEffectParametersSchemainterpolation -
EvolveIntoEffectSpecificationinterpolation -
ExpandEffectParametersinterpolation -
ExpandEffectParametersSchemainterpolation -
ExpandEffectSpecificationinterpolation -
ExplodeEffectParametersinterpolation -
ExplodeEffectParametersSchemainterpolation -
ExplodeEffectSpecificationinterpolation -
FadeFromEffectParametersinterpolation -
FadeFromEffectParametersSchemainterpolation -
FadeFromEffectSpecificationinterpolation -
FadeToEffectParametersinterpolation -
FadeToEffectParametersSchemainterpolation -
FadeToEffectSpecificationinterpolation -
HslShiftEffectParametersinterpolation -
HslShiftEffectParametersSchemainterpolation -
HslShiftEffectSpecificationinterpolation -
LightenEffectParametersinterpolation -
LightenEffectParametersSchemainterpolation -
LightenEffectSpecificationinterpolation -
PaintEffectParametersinterpolation -
PaintEffectParametersSchemainterpolation -
PaintEffectSpecificationinterpolation -
SaturateEffectParametersinterpolation -
SaturateEffectParametersSchemainterpolation -
SaturateEffectSpecificationinterpolation -
SleepEffectParametersinterpolation -
SleepEffectParametersSchemainterpolation -
SleepEffectSpecificationinterpolation -
SlideInEffectParametersinterpolation -
SlideInEffectParametersSchemainterpolation -
SlideInEffectSpecificationinterpolation -
SlideOutEffectParametersinterpolation -
SlideOutEffectParametersSchemainterpolation -
SlideOutEffectSpecificationinterpolation -
StretchEffectParametersinterpolation -
StretchEffectParametersSchemainterpolation -
StretchEffectSpecificationinterpolation -
SweepInEffectParametersinterpolation -
SweepInEffectParametersSchemainterpolation -
SweepInEffectSpecificationinterpolation -
SweepOutEffectParametersinterpolation -
SweepOutEffectParametersSchemainterpolation -
SweepOutEffectSpecificationinterpolation
-
-
API Reference
xnano
xnano.effects
effects-
CoalesceEffectParameters -
DarkenEffectParameters -
DissolveEffectParameters -
EffectController -
EvolveEffectParameters -
EvolveFromEffectParameters -
EvolveIntoEffectParameters -
ExpandEffectParameters -
ExplodeEffectParameters -
FadeFromEffectParameters -
FadeToEffectParameters -
HslShiftEffectParameters -
LightenEffectParameters -
PaintEffectParameters -
SaturateEffectParameters -
SleepEffectParameters -
SlideInEffectParameters -
SlideOutEffectParameters -
StretchEffectParameters -
SweepInEffectParameters -
SweepOutEffectParameters -
WritableEffectProperties
-
MotionDirection
module-attribute
¶
The direction a sweep, slide or stretch effect moves in.
-
API Reference
xnano
xnano.effects
effects-
SlideInEffectParametersdirection -
SlideInEffectParametersSchemadirection -
SlideInEffectSpecificationdirection -
SlideOutEffectParametersdirection -
SlideOutEffectParametersSchemadirection -
SlideOutEffectSpecificationdirection -
StretchEffectParametersdirection -
StretchEffectParametersSchemadirection -
StretchEffectSpecificationdirection -
SweepInEffectParametersdirection -
SweepInEffectParametersSchemadirection -
SweepInEffectSpecificationdirection -
SweepOutEffectParametersdirection -
SweepOutEffectParametersSchemadirection -
SweepOutEffectSpecificationdirection
-
BitCrushAudioEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('audio.bit_crush', ...).
Attributes:
-
bits(int) –Quantization resolution in bits (
1to16). -
downsample(int) –Sample-hold factor (
1to256).
BitCrushAudioEffectSpecification
¶
Bases: BitCrushAudioEffectParametersSchema
The dictionary form of the 'audio.bit_crush' sound effect in effects=[...].
Attributes:
CoalesceEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.coalesce', ...).
Attributes:
-
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.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
CoalesceEffectSpecification
¶
Bases: CoalesceEffectParametersSchema
The dictionary form of the 'effect.coalesce' visual effect in effects=[...].
Attributes:
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
DarkenEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.darken', ...).
Attributes:
-
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.
foreground
instance-attribute
¶
foreground: float | Expression[int | float] | None
Foreground darkness increase, or None.
background
instance-attribute
¶
background: float | Expression[int | float] | None
Background darkness increase, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
DarkenEffectSpecification
¶
Bases: DarkenEffectParametersSchema
The dictionary form of the 'effect.darken' visual effect in effects=[...].
Attributes:
foreground
instance-attribute
¶
foreground: float | Expression[int | float] | None
Foreground darkness increase, or None.
background
instance-attribute
¶
background: float | Expression[int | float] | None
Background darkness increase, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
DelayAudioEffectParametersSchema
¶
DelayAudioEffectSpecification
¶
Bases: DelayAudioEffectParametersSchema
The dictionary form of the 'audio.delay' sound effect in effects=[...].
Attributes:
DissolveEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.dissolve', ...).
Attributes:
-
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.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
DissolveEffectSpecification
¶
Bases: DissolveEffectParametersSchema
The dictionary form of the 'effect.dissolve' visual effect in effects=[...].
Attributes:
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
DistortionAudioEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('audio.distortion', ...).
Attributes:
DistortionAudioEffectSpecification
¶
Bases: DistortionAudioEffectParametersSchema
The dictionary form of the 'audio.distortion' sound effect in effects=[...].
Attributes:
EvolveEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.evolve', ...).
Attributes:
-
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.
symbols
instance-attribute
¶
symbols: EvolveSymbolSet | Expression[str] | None
The symbols stepped through, such as 'circles', 'squares' or 'shaded'.
style
instance-attribute
¶
style: Style | DynamicStyle | None
Optional style applied to the evolving symbols.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
EvolveEffectSpecification
¶
Bases: EvolveEffectParametersSchema
The dictionary form of the 'effect.evolve' visual effect in effects=[...].
Attributes:
symbols
instance-attribute
¶
symbols: EvolveSymbolSet | Expression[str] | None
The symbols stepped through, such as 'circles', 'squares' or 'shaded'.
style
instance-attribute
¶
style: Style | DynamicStyle | None
Optional style applied to the evolving symbols.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
EvolveFromEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.evolve_from', ...).
Attributes:
-
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.
symbols
instance-attribute
¶
symbols: EvolveSymbolSet | Expression[str] | None
The symbols stepped through, such as 'circles', 'squares' or 'shaded'.
style
instance-attribute
¶
style: Style | DynamicStyle | None
Optional style applied to the evolving symbols.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
EvolveFromEffectSpecification
¶
Bases: EvolveFromEffectParametersSchema
The dictionary form of the 'effect.evolve_from' visual effect in effects=[...].
Attributes:
symbols
instance-attribute
¶
symbols: EvolveSymbolSet | Expression[str] | None
The symbols stepped through, such as 'circles', 'squares' or 'shaded'.
style
instance-attribute
¶
style: Style | DynamicStyle | None
Optional style applied to the evolving symbols.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
EvolveIntoEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.evolve_into', ...).
Attributes:
-
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.
symbols
instance-attribute
¶
symbols: EvolveSymbolSet | Expression[str] | None
The symbols stepped through, such as 'circles', 'squares' or 'shaded'.
style
instance-attribute
¶
style: Style | DynamicStyle | None
Optional style applied to the evolving symbols.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
EvolveIntoEffectSpecification
¶
Bases: EvolveIntoEffectParametersSchema
The dictionary form of the 'effect.evolve_into' visual effect in effects=[...].
Attributes:
symbols
instance-attribute
¶
symbols: EvolveSymbolSet | Expression[str] | None
The symbols stepped through, such as 'circles', 'squares' or 'shaded'.
style
instance-attribute
¶
style: Style | DynamicStyle | None
Optional style applied to the evolving symbols.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
ExpandEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.expand', ...).
Attributes:
-
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.
direction
instance-attribute
¶
direction: Literal['horizontal', 'vertical'] | Expression[str] | None
'horizontal' or 'vertical'.
style
instance-attribute
¶
style: Style | DynamicStyle | None
Style expanded outward from the center.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
ExpandEffectSpecification
¶
Bases: ExpandEffectParametersSchema
The dictionary form of the 'effect.expand' visual effect in effects=[...].
Attributes:
direction
instance-attribute
¶
direction: Literal['horizontal', 'vertical'] | Expression[str] | None
'horizontal' or 'vertical'.
style
instance-attribute
¶
style: Style | DynamicStyle | None
Style expanded outward from the center.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
ExplodeEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.explode', ...).
Attributes:
-
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.
force
instance-attribute
¶
force: float | Expression[int | float] | None
Outward force throwing the cells.
randomness
instance-attribute
¶
randomness: float | Expression[int | float] | None
Variation in force from cell to cell.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
ExplodeEffectSpecification
¶
Bases: ExplodeEffectParametersSchema
The dictionary form of the 'effect.explode' visual effect in effects=[...].
Attributes:
force
instance-attribute
¶
force: float | Expression[int | float] | None
Outward force throwing the cells.
randomness
instance-attribute
¶
randomness: float | Expression[int | float] | None
Variation in force from cell to cell.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
FadeFromEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.fade_from', ...).
Attributes:
-
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.
foreground
instance-attribute
¶
foreground: ColorValue | Expression[ColorValue] | None
Starting foreground color, or None.
background
instance-attribute
¶
background: ColorValue | Expression[ColorValue] | None
Starting background color, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration of the fade in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
FadeFromEffectSpecification
¶
Bases: FadeFromEffectParametersSchema
The dictionary form of the 'effect.fade_from' visual effect in effects=[...].
Attributes:
foreground
instance-attribute
¶
foreground: ColorValue | Expression[ColorValue] | None
Starting foreground color, or None.
background
instance-attribute
¶
background: ColorValue | Expression[ColorValue] | None
Starting background color, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration of the fade in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
FadeToEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.fade_to', ...).
Attributes:
-
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.
foreground
instance-attribute
¶
foreground: ColorValue | Expression[ColorValue] | None
Target foreground color, or None.
background
instance-attribute
¶
background: ColorValue | Expression[ColorValue] | None
Target background color, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration of the fade in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
FadeToEffectSpecification
¶
Bases: FadeToEffectParametersSchema
The dictionary form of the 'effect.fade_to' visual effect in effects=[...].
Attributes:
foreground
instance-attribute
¶
foreground: ColorValue | Expression[ColorValue] | None
Target foreground color, or None.
background
instance-attribute
¶
background: ColorValue | Expression[ColorValue] | None
Target background color, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration of the fade in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
GlitchEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.glitch', ...).
Attributes:
-
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.
ratio
instance-attribute
¶
ratio: float | Expression[int | float] | None
Fraction of cells affected by the glitch.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
start_delay_milliseconds
instance-attribute
¶
(minimum, maximum) delay before a cell glitches.
action_milliseconds
instance-attribute
¶
(minimum, maximum) duration of each cell glitch.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
GlitchEffectSpecification
¶
Bases: GlitchEffectParametersSchema
The dictionary form of the 'effect.glitch' visual effect in effects=[...].
Attributes:
ratio
instance-attribute
¶
ratio: float | Expression[int | float] | None
Fraction of cells affected by the glitch.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
start_delay_milliseconds
instance-attribute
¶
(minimum, maximum) delay before a cell glitches.
action_milliseconds
instance-attribute
¶
(minimum, maximum) duration of each cell glitch.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
HighPassAudioEffectParametersSchema
¶
HighPassAudioEffectSpecification
¶
Bases: HighPassAudioEffectParametersSchema
The dictionary form of the 'audio.high_pass' sound effect in effects=[...].
Attributes:
HslShiftEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.hsl_shift', ...).
Attributes:
-
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.
foreground
instance-attribute
¶
(hue, saturation, lightness) shift for foreground colors.
background
instance-attribute
¶
(hue, saturation, lightness) shift for background colors.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
HslShiftEffectSpecification
¶
Bases: HslShiftEffectParametersSchema
The dictionary form of the 'effect.hsl_shift' visual effect in effects=[...].
Attributes:
foreground
instance-attribute
¶
(hue, saturation, lightness) shift for foreground colors.
background
instance-attribute
¶
(hue, saturation, lightness) shift for background colors.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
LightenEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.lighten', ...).
Attributes:
-
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.
foreground
instance-attribute
¶
foreground: float | Expression[int | float] | None
Foreground lightness increase, or None.
background
instance-attribute
¶
background: float | Expression[int | float] | None
Background lightness increase, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
LightenEffectSpecification
¶
Bases: LightenEffectParametersSchema
The dictionary form of the 'effect.lighten' visual effect in effects=[...].
Attributes:
foreground
instance-attribute
¶
foreground: float | Expression[int | float] | None
Foreground lightness increase, or None.
background
instance-attribute
¶
background: float | Expression[int | float] | None
Background lightness increase, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
LowPassAudioEffectParametersSchema
¶
LowPassAudioEffectSpecification
¶
Bases: LowPassAudioEffectParametersSchema
The dictionary form of the 'audio.low_pass' sound effect in effects=[...].
Attributes:
PaintEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.paint', ...).
Attributes:
-
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.
foreground
instance-attribute
¶
foreground: ColorValue | Expression[ColorValue] | None
Foreground color to paint, or None.
background
instance-attribute
¶
background: ColorValue | Expression[ColorValue] | None
Background color to paint, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
PaintEffectSpecification
¶
Bases: PaintEffectParametersSchema
The dictionary form of the 'effect.paint' visual effect in effects=[...].
Attributes:
foreground
instance-attribute
¶
foreground: ColorValue | Expression[ColorValue] | None
Foreground color to paint, or None.
background
instance-attribute
¶
background: ColorValue | Expression[ColorValue] | None
Background color to paint, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
ReverbAudioEffectParametersSchema
¶
ReverbAudioEffectSpecification
¶
Bases: ReverbAudioEffectParametersSchema
The dictionary form of the 'audio.reverb' sound effect in effects=[...].
Attributes:
SaturateEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.saturate', ...).
Attributes:
-
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.
foreground
instance-attribute
¶
foreground: float | Expression[int | float] | None
Foreground saturation change, or None.
background
instance-attribute
¶
background: float | Expression[int | float] | None
Background saturation change, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
SaturateEffectSpecification
¶
Bases: SaturateEffectParametersSchema
The dictionary form of the 'effect.saturate' visual effect in effects=[...].
Attributes:
foreground
instance-attribute
¶
foreground: float | Expression[int | float] | None
Foreground saturation change, or None.
background
instance-attribute
¶
background: float | Expression[int | float] | None
Background saturation change, or None.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
SleepEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.sleep', ...).
Attributes:
-
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.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float]
Pause duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
SleepEffectSpecification
¶
Bases: SleepEffectParametersSchema
The dictionary form of the 'effect.sleep' visual effect in effects=[...].
Attributes:
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float]
Pause duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
SlideInEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.slide_in', ...).
Attributes:
-
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.
direction
instance-attribute
¶
direction: MotionDirection | Expression[str] | None
Slide direction (such as 'left_to_right').
gradient_length
instance-attribute
¶
gradient_length: int | Expression[int | float] | None
Length of the gradient trail in cells.
randomness
instance-attribute
¶
randomness: int | Expression[int | float] | None
Random offset across rows or columns.
color
instance-attribute
¶
color: ColorValue | Expression[ColorValue] | None
Color behind the sliding cells.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
SlideInEffectSpecification
¶
Bases: SlideInEffectParametersSchema
The dictionary form of the 'effect.slide_in' visual effect in effects=[...].
Attributes:
direction
instance-attribute
¶
direction: MotionDirection | Expression[str] | None
Slide direction (such as 'left_to_right').
gradient_length
instance-attribute
¶
gradient_length: int | Expression[int | float] | None
Length of the gradient trail in cells.
randomness
instance-attribute
¶
randomness: int | Expression[int | float] | None
Random offset across rows or columns.
color
instance-attribute
¶
color: ColorValue | Expression[ColorValue] | None
Color behind the sliding cells.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
SlideOutEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.slide_out', ...).
Attributes:
-
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.
direction
instance-attribute
¶
direction: MotionDirection | Expression[str] | None
Slide direction (such as 'left_to_right').
gradient_length
instance-attribute
¶
gradient_length: int | Expression[int | float] | None
Length of the gradient trail in cells.
randomness
instance-attribute
¶
randomness: int | Expression[int | float] | None
Random offset across rows or columns.
color
instance-attribute
¶
color: ColorValue | Expression[ColorValue] | None
Color left behind the sliding cells.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
SlideOutEffectSpecification
¶
Bases: SlideOutEffectParametersSchema
The dictionary form of the 'effect.slide_out' visual effect in effects=[...].
Attributes:
direction
instance-attribute
¶
direction: MotionDirection | Expression[str] | None
Slide direction (such as 'left_to_right').
gradient_length
instance-attribute
¶
gradient_length: int | Expression[int | float] | None
Length of the gradient trail in cells.
randomness
instance-attribute
¶
randomness: int | Expression[int | float] | None
Random offset across rows or columns.
color
instance-attribute
¶
color: ColorValue | Expression[ColorValue] | None
Color left behind the sliding cells.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
StretchEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.stretch', ...).
Attributes:
-
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.
direction
instance-attribute
¶
direction: MotionDirection | Expression[str] | None
'left_to_right', 'right_to_left', 'up_to_down' or 'down_to_up'.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
StretchEffectSpecification
¶
Bases: StretchEffectParametersSchema
The dictionary form of the 'effect.stretch' visual effect in effects=[...].
Attributes:
direction
instance-attribute
¶
direction: MotionDirection | Expression[str] | None
'left_to_right', 'right_to_left', 'up_to_down' or 'down_to_up'.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
SweepInEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.sweep_in', ...).
Attributes:
-
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.
direction
instance-attribute
¶
direction: MotionDirection | Expression[str] | None
Sweep direction (such as 'left_to_right').
gradient_length
instance-attribute
¶
gradient_length: int | Expression[int | float] | None
Length of the sweep gradient in cells.
randomness
instance-attribute
¶
randomness: int | Expression[int | float] | None
Random offset across rows or columns.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
SweepInEffectSpecification
¶
Bases: SweepInEffectParametersSchema
The dictionary form of the 'effect.sweep_in' visual effect in effects=[...].
Attributes:
direction
instance-attribute
¶
direction: MotionDirection | Expression[str] | None
Sweep direction (such as 'left_to_right').
gradient_length
instance-attribute
¶
gradient_length: int | Expression[int | float] | None
Length of the sweep gradient in cells.
randomness
instance-attribute
¶
randomness: int | Expression[int | float] | None
Random offset across rows or columns.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
SweepOutEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('effect.sweep_out', ...).
Attributes:
-
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.
direction
instance-attribute
¶
direction: MotionDirection | Expression[str] | None
Sweep direction (such as 'left_to_right').
gradient_length
instance-attribute
¶
gradient_length: int | Expression[int | float] | None
Length of the sweep gradient in cells.
randomness
instance-attribute
¶
randomness: int | Expression[int | float] | None
Random offset across rows or columns.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
SweepOutEffectSpecification
¶
Bases: SweepOutEffectParametersSchema
The dictionary form of the 'effect.sweep_out' visual effect in effects=[...].
Attributes:
direction
instance-attribute
¶
direction: MotionDirection | Expression[str] | None
Sweep direction (such as 'left_to_right').
gradient_length
instance-attribute
¶
gradient_length: int | Expression[int | float] | None
Length of the sweep gradient in cells.
randomness
instance-attribute
¶
randomness: int | Expression[int | float] | None
Random offset across rows or columns.
duration_milliseconds
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None
Duration in milliseconds.
interpolation
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None
The easing curve, such as 'linear' or 'quad_in_out'.
key
instance-attribute
¶
key: str | Expression[str] | None
Optional effect key for replacement or cancellation.
TremoloAudioEffectParametersSchema
¶
Bases: TypedDict
The keyword arguments of effect('audio.tremolo', ...).
Attributes:
-
rate_hertz(float) –Modulation rate in hertz (
0.1to40.0). -
depth(float) –Modulation depth (
0.0to1.0).
TremoloAudioEffectSpecification
¶
Bases: TremoloAudioEffectParametersSchema
The dictionary form of the 'audio.tremolo' sound effect in effects=[...].
Attributes:
EffectController
¶
Bases: _WritableEffectMethods, _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 target, 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:
-
context(Context[object, object]) –The context of the hook that applies the effects.
-
active(tuple[EffectSpecification, ...]) –The effects the hook has set and not cleared or replaced.
Examples:
import xnano
with xnano.new(width=8, height=1) as canvas:
label = canvas.screen.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.clock.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
cutoffand soften those above it. -
high_pass–Keep the frequencies above
cutoffand 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
foregroundandbackground. -
fade_from–Fade the colors in from
foregroundandbackground. -
paint–Paint
foregroundandbackgroundover 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
colorindirection. -
sweep_out–Hide the content behind a sweep of
colorindirection. -
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_millisecondswithout 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
styleoutward from the center. -
stretch–Stretch
styleacross the area indirection. -
explode–Throw the cells outward.
-
clear–End the effects this hook has set.
Source code in xnano/effects/_controller.py
context
property
¶
The context of the hook that applies the effects.
active
property
¶
active: tuple[EffectSpecification, ...]
The effects the hook has set and not cleared or replaced.
bit_crush
¶
bit_crush(**parameters: Unpack[BitCrushAudioEffectParametersSchema]) -> BitCrushAudioEffectParameters
Lower the resolution of the sound, for a gritty, retro tone.
Other Parameters:
-
bits(int) –Quantization resolution in bits (
1to16). -
downsample(int) –Sample-hold factor (
1to256).
Returns:
-
BitCrushAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def bit_crush(
self, **parameters: Unpack[BitCrushAudioEffectParametersSchema]
) -> BitCrushAudioEffectParameters:
"""
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(
'BitCrushAudioEffectParameters', self._start('audio.bit_crush', parameters)
)
distortion
¶
distortion(**parameters: Unpack[DistortionAudioEffectParametersSchema]) -> DistortionAudioEffectParameters
Distort the sound by driving it into soft clipping.
Other Parameters:
-
drive(float) –Input gain before soft-clipping (
0.1to100.0).
Returns:
-
DistortionAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def distortion(
self, **parameters: Unpack[DistortionAudioEffectParametersSchema]
) -> DistortionAudioEffectParameters:
"""
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(
'DistortionAudioEffectParameters', self._start('audio.distortion', parameters)
)
low_pass
¶
low_pass(**parameters: Unpack[LowPassAudioEffectParametersSchema]) -> LowPassAudioEffectParameters
Keep the frequencies below cutoff and soften those above it.
Other Parameters:
-
cutoff(float) –Corner frequency in hertz (
20.0to20000.0). -
resonance(float) –Filter resonance Q (
0.1to20.0).
Returns:
-
LowPassAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def low_pass(
self, **parameters: Unpack[LowPassAudioEffectParametersSchema]
) -> LowPassAudioEffectParameters:
"""
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(
'LowPassAudioEffectParameters', self._start('audio.low_pass', parameters)
)
high_pass
¶
high_pass(**parameters: Unpack[HighPassAudioEffectParametersSchema]) -> HighPassAudioEffectParameters
Keep the frequencies above cutoff and soften those below it.
Other Parameters:
-
cutoff(float) –Corner frequency in hertz (
20.0to20000.0). -
resonance(float) –Filter resonance Q (
0.1to20.0).
Returns:
-
HighPassAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def high_pass(
self, **parameters: Unpack[HighPassAudioEffectParametersSchema]
) -> HighPassAudioEffectParameters:
"""
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(
'HighPassAudioEffectParameters', self._start('audio.high_pass', parameters)
)
delay
¶
delay(**parameters: Unpack[DelayAudioEffectParametersSchema]) -> DelayAudioEffectParameters
Repeat the sound as fading echoes.
Other Parameters:
-
time_milliseconds(float) –Delay time between echoes in milliseconds (
1.0to2000.0). -
feedback(float) –Echo feedback ratio (
0.0to0.95). -
mix(float) –Wet/dry mix ratio (
0.0to1.0).
Returns:
-
DelayAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def delay(
self, **parameters: Unpack[DelayAudioEffectParametersSchema]
) -> DelayAudioEffectParameters:
"""
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('DelayAudioEffectParameters', self._start('audio.delay', parameters))
reverb
¶
reverb(**parameters: Unpack[ReverbAudioEffectParametersSchema]) -> ReverbAudioEffectParameters
Add the reverberation of a room.
Other Parameters:
-
room(float) –Room size (
0.0to1.0). -
damping(float) –High-frequency damping (
0.0to1.0). -
mix(float) –Wet/dry mix ratio (
0.0to1.0).
Returns:
-
ReverbAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def reverb(
self, **parameters: Unpack[ReverbAudioEffectParametersSchema]
) -> ReverbAudioEffectParameters:
"""
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(
'ReverbAudioEffectParameters', self._start('audio.reverb', parameters)
)
tremolo
¶
tremolo(**parameters: Unpack[TremoloAudioEffectParametersSchema]) -> TremoloAudioEffectParameters
Pulse the volume up and down.
Other Parameters:
-
rate_hertz(float) –Modulation rate in hertz (
0.1to40.0). -
depth(float) –Modulation depth (
0.0to1.0).
Returns:
-
TremoloAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def tremolo(
self, **parameters: Unpack[TremoloAudioEffectParametersSchema]
) -> TremoloAudioEffectParameters:
"""
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(
'TremoloAudioEffectParameters', self._start('audio.tremolo', parameters)
)
fade_to
¶
fade_to(**parameters: Unpack[FadeToEffectParametersSchema]) -> FadeToEffectParameters
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:
-
FadeToEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
FadeToEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def fade_to(
self, **parameters: Unpack[FadeToEffectParametersSchema]
) -> FadeToEffectParameters:
"""
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('FadeToEffectParameters', self._start('effect.fade_to', parameters))
fade_from
¶
fade_from(**parameters: Unpack[FadeFromEffectParametersSchema]) -> FadeFromEffectParameters
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:
-
FadeFromEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
FadeFromEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def fade_from(
self, **parameters: Unpack[FadeFromEffectParametersSchema]
) -> FadeFromEffectParameters:
"""
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(
'FadeFromEffectParameters', self._start('effect.fade_from', parameters)
)
paint
¶
paint(**parameters: Unpack[PaintEffectParametersSchema]) -> PaintEffectParameters
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:
-
PaintEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
PaintEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def paint(
self, **parameters: Unpack[PaintEffectParametersSchema]
) -> PaintEffectParameters:
"""
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('PaintEffectParameters', self._start('effect.paint', parameters))
saturate
¶
saturate(**parameters: Unpack[SaturateEffectParametersSchema]) -> SaturateEffectParameters
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:
-
SaturateEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
SaturateEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def saturate(
self, **parameters: Unpack[SaturateEffectParametersSchema]
) -> SaturateEffectParameters:
"""
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(
'SaturateEffectParameters', self._start('effect.saturate', parameters)
)
lighten
¶
lighten(**parameters: Unpack[LightenEffectParametersSchema]) -> LightenEffectParameters
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:
-
LightenEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
LightenEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def lighten(
self, **parameters: Unpack[LightenEffectParametersSchema]
) -> LightenEffectParameters:
"""
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('LightenEffectParameters', self._start('effect.lighten', parameters))
darken
¶
darken(**parameters: Unpack[DarkenEffectParametersSchema]) -> DarkenEffectParameters
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:
-
DarkenEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
DarkenEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def darken(
self, **parameters: Unpack[DarkenEffectParametersSchema]
) -> DarkenEffectParameters:
"""
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('DarkenEffectParameters', self._start('effect.darken', parameters))
sweep_in
¶
sweep_in(**parameters: Unpack[SweepInEffectParametersSchema]) -> SweepInEffectParameters
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:
-
SweepInEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
SweepInEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def sweep_in(
self, **parameters: Unpack[SweepInEffectParametersSchema]
) -> SweepInEffectParameters:
"""
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('SweepInEffectParameters', self._start('effect.sweep_in', parameters))
sweep_out
¶
sweep_out(**parameters: Unpack[SweepOutEffectParametersSchema]) -> SweepOutEffectParameters
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:
-
SweepOutEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
SweepOutEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def sweep_out(
self, **parameters: Unpack[SweepOutEffectParametersSchema]
) -> SweepOutEffectParameters:
"""
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(
'SweepOutEffectParameters', self._start('effect.sweep_out', parameters)
)
slide_in
¶
slide_in(**parameters: Unpack[SlideInEffectParametersSchema]) -> SlideInEffectParameters
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:
-
SlideInEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
SlideInEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def slide_in(
self, **parameters: Unpack[SlideInEffectParametersSchema]
) -> SlideInEffectParameters:
"""
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('SlideInEffectParameters', self._start('effect.slide_in', parameters))
slide_out
¶
slide_out(**parameters: Unpack[SlideOutEffectParametersSchema]) -> SlideOutEffectParameters
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:
-
SlideOutEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
SlideOutEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def slide_out(
self, **parameters: Unpack[SlideOutEffectParametersSchema]
) -> SlideOutEffectParameters:
"""
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(
'SlideOutEffectParameters', self._start('effect.slide_out', parameters)
)
hsl_shift
¶
hsl_shift(**parameters: Unpack[HslShiftEffectParametersSchema]) -> HslShiftEffectParameters
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:
-
HslShiftEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
HslShiftEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def hsl_shift(
self, **parameters: Unpack[HslShiftEffectParametersSchema]
) -> HslShiftEffectParameters:
"""
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(
'HslShiftEffectParameters', self._start('effect.hsl_shift', parameters)
)
dissolve
¶
dissolve(**parameters: Unpack[DissolveEffectParametersSchema]) -> DissolveEffectParameters
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:
-
DissolveEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
DissolveEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def dissolve(
self, **parameters: Unpack[DissolveEffectParametersSchema]
) -> DissolveEffectParameters:
"""
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(
'DissolveEffectParameters', self._start('effect.dissolve', parameters)
)
coalesce
¶
coalesce(**parameters: Unpack[CoalesceEffectParametersSchema]) -> CoalesceEffectParameters
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:
-
CoalesceEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
CoalesceEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def coalesce(
self, **parameters: Unpack[CoalesceEffectParametersSchema]
) -> CoalesceEffectParameters:
"""
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(
'CoalesceEffectParameters', self._start('effect.coalesce', parameters)
)
glitch
¶
glitch(**parameters: Unpack[GlitchEffectParametersSchema]) -> GlitchEffectParameters
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:
-
GlitchEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
GlitchEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def glitch(
self, **parameters: Unpack[GlitchEffectParametersSchema]
) -> GlitchEffectParameters:
"""
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('GlitchEffectParameters', self._start('effect.glitch', parameters))
sleep
¶
sleep(**parameters: Unpack[SleepEffectParametersSchema]) -> SleepEffectParameters
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:
-
SleepEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
SleepEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def sleep(
self, **parameters: Unpack[SleepEffectParametersSchema]
) -> SleepEffectParameters:
"""
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('SleepEffectParameters', self._start('effect.sleep', parameters))
evolve
¶
evolve(**parameters: Unpack[EvolveEffectParametersSchema]) -> EvolveEffectParameters
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:
-
EvolveEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
EvolveEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def evolve(
self, **parameters: Unpack[EvolveEffectParametersSchema]
) -> EvolveEffectParameters:
"""
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('EvolveEffectParameters', self._start('effect.evolve', parameters))
evolve_into
¶
evolve_into(**parameters: Unpack[EvolveIntoEffectParametersSchema]) -> EvolveIntoEffectParameters
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:
-
EvolveIntoEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
EvolveIntoEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def evolve_into(
self, **parameters: Unpack[EvolveIntoEffectParametersSchema]
) -> EvolveIntoEffectParameters:
"""
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(
'EvolveIntoEffectParameters', self._start('effect.evolve_into', parameters)
)
evolve_from
¶
evolve_from(**parameters: Unpack[EvolveFromEffectParametersSchema]) -> EvolveFromEffectParameters
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:
-
EvolveFromEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
EvolveFromEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def evolve_from(
self, **parameters: Unpack[EvolveFromEffectParametersSchema]
) -> EvolveFromEffectParameters:
"""
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(
'EvolveFromEffectParameters', self._start('effect.evolve_from', parameters)
)
expand
¶
expand(**parameters: Unpack[ExpandEffectParametersSchema]) -> ExpandEffectParameters
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:
-
ExpandEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
ExpandEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def expand(
self, **parameters: Unpack[ExpandEffectParametersSchema]
) -> ExpandEffectParameters:
"""
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('ExpandEffectParameters', self._start('effect.expand', parameters))
stretch
¶
stretch(**parameters: Unpack[StretchEffectParametersSchema]) -> StretchEffectParameters
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:
-
StretchEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
StretchEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def stretch(
self, **parameters: Unpack[StretchEffectParametersSchema]
) -> StretchEffectParameters:
"""
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('StretchEffectParameters', self._start('effect.stretch', parameters))
explode
¶
explode(**parameters: Unpack[ExplodeEffectParametersSchema]) -> ExplodeEffectParameters
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:
-
ExplodeEffectParameters–The running effect. Assigning one of its fields starts it again with the new
-
ExplodeEffectParameters–values, and
cancel()stops it.
Source code in xnano/effects/_properties.py
def explode(
self, **parameters: Unpack[ExplodeEffectParametersSchema]
) -> ExplodeEffectParameters:
"""
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('ExplodeEffectParameters', self._start('effect.explode', parameters))
clear
¶
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/effects/_controller.py
AudioEffectParameters
¶
Bases: EffectParameters
The base of the parameters of every sound effect ('audio.<name>').
Attributes:
-
customization_kind(str) –Identifier of the sound effect kind, such as
'audio.reverb'.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
-
to_audio_effect–The
TerminalAudioEffectthis effect builds.
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
customization_kind
instance-attribute
¶
customization_kind: str
The kind, such as 'style' or 'effect.fade_to'.
parameters
property
¶
The parameters by name, with defaults filled in.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
to_audio_effect
¶
to_audio_effect() -> TerminalAudioEffect
The TerminalAudioEffect this effect builds.
BitCrushAudioEffectParameters
dataclass
¶
Bases: AudioEffectParameters
The parameters of the 'audio.bit_crush' sound effect.
Attributes:
-
bits(int) –Quantization resolution in bits (
1to16). -
downsample(int) –Sample-hold factor (
1to256).
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The
TerminalAudioEffectthis effect builds. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> TerminalAudioEffect
The TerminalAudioEffect this effect builds.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
CoalesceEffectParameters
dataclass
¶
CoalesceEffectParameters(style: Style | DynamicStyle | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.coalesce' visual effect (Effect.coalesce).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
style
class-attribute
instance-attribute
¶
style: Style | DynamicStyle | None = None
Style coalesced from.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
DarkenEffectParameters
dataclass
¶
DarkenEffectParameters(foreground: float | Expression[int | float] | None = None, background: float | Expression[int | float] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.darken' visual effect (Effect.darken).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
foreground
class-attribute
instance-attribute
¶
foreground: float | Expression[int | float] | None = None
Foreground darkness increase, or None.
background
class-attribute
instance-attribute
¶
background: float | Expression[int | float] | None = None
Background darkness increase, or None.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
DelayAudioEffectParameters
dataclass
¶
DelayAudioEffectParameters(time_milliseconds: float = 250.0, feedback: float = 0.4, mix: float = 0.35)
Bases: AudioEffectParameters
The parameters of the 'audio.delay' sound effect.
Attributes:
-
time_milliseconds(float) –Delay time between echoes in milliseconds (
1.0to2000.0). -
feedback(float) –Echo feedback ratio (
0.0to0.95). -
mix(float) –Wet/dry mix ratio (
0.0to1.0).
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The
TerminalAudioEffectthis effect builds. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
time_milliseconds
class-attribute
instance-attribute
¶
time_milliseconds: float = 250.0
Delay time between echoes in milliseconds (1.0 to 2000.0).
feedback
class-attribute
instance-attribute
¶
feedback: float = 0.4
Echo feedback ratio (0.0 to 0.95).
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> TerminalAudioEffect
The TerminalAudioEffect this effect builds.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
DissolveEffectParameters
dataclass
¶
DissolveEffectParameters(style: Style | DynamicStyle | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.dissolve' visual effect (Effect.dissolve).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
style
class-attribute
instance-attribute
¶
style: Style | DynamicStyle | None = None
Style dissolved into.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
DistortionAudioEffectParameters
dataclass
¶
DistortionAudioEffectParameters(drive: float = 4.0)
Bases: AudioEffectParameters
The parameters of the 'audio.distortion' sound effect.
Attributes:
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The
TerminalAudioEffectthis effect builds. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
drive
class-attribute
instance-attribute
¶
drive: float = 4.0
Input gain before soft-clipping (0.1 to 100.0).
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> TerminalAudioEffect
The TerminalAudioEffect this effect builds.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
EffectParameters
¶
Bases: DynamicOperation
The base of the parameters of every effect that effect returns.
An effect is both a dataclass holding its typed parameters and a native
Customization operation. It can be applied with |,
passed to add and update, returned from a hook or listed in
effects=. The parameters are read when it is applied, so editing a field changes what
it does.
Attributes:
-
customization_kind(str) –Identifier of the effect kind, such as
'effect.dissolve'or'audio.reverb'.
-
API Reference
xnano
xnano.effects
effects-
AudioEffectParameters -
CoalesceEffectParameters -
DarkenEffectParameters -
DissolveEffectParameters -
EvolveEffectParameters -
EvolveFromEffectParameters -
EvolveIntoEffectParameters -
ExpandEffectParameters -
ExplodeEffectParameters -
FadeFromEffectParameters -
FadeToEffectParameters -
GlitchEffectParameters -
HslShiftEffectParameters -
LightenEffectParameters -
PaintEffectParameters -
SaturateEffectParameters -
SleepEffectParameters -
SlideInEffectParameters -
SlideOutEffectParameters -
StretchEffectParameters -
SweepInEffectParameters -
SweepOutEffectParameters
-
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
customization_kind
instance-attribute
¶
customization_kind: str
The kind, such as 'style' or 'effect.fade_to'.
parameters
property
¶
The parameters by name, with defaults filled in.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
EvolveEffectParameters
dataclass
¶
EvolveEffectParameters(symbols: EvolveSymbolSet | Expression[str] | None = None, style: Style | DynamicStyle | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.evolve' visual effect (Effect.evolve).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
symbols
class-attribute
instance-attribute
¶
symbols: EvolveSymbolSet | Expression[str] | None = None
The symbols stepped through, such as 'circles', 'squares' or 'shaded'.
style
class-attribute
instance-attribute
¶
style: Style | DynamicStyle | None = None
Optional style applied to the evolving symbols.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
EvolveFromEffectParameters
dataclass
¶
EvolveFromEffectParameters(symbols: EvolveSymbolSet | Expression[str] | None = None, style: Style | DynamicStyle | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.evolve_from' visual effect (Effect.evolve_from).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
symbols
class-attribute
instance-attribute
¶
symbols: EvolveSymbolSet | Expression[str] | None = None
The symbols stepped through, such as 'circles', 'squares' or 'shaded'.
style
class-attribute
instance-attribute
¶
style: Style | DynamicStyle | None = None
Optional style applied to the evolving symbols.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
EvolveIntoEffectParameters
dataclass
¶
EvolveIntoEffectParameters(symbols: EvolveSymbolSet | Expression[str] | None = None, style: Style | DynamicStyle | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.evolve_into' visual effect (Effect.evolve_into).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
symbols
class-attribute
instance-attribute
¶
symbols: EvolveSymbolSet | Expression[str] | None = None
The symbols stepped through, such as 'circles', 'squares' or 'shaded'.
style
class-attribute
instance-attribute
¶
style: Style | DynamicStyle | None = None
Optional style applied to the evolving symbols.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
ExpandEffectParameters
dataclass
¶
ExpandEffectParameters(direction: Literal['horizontal', 'vertical'] | Expression[str] | None = None, style: Style | DynamicStyle | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.expand' visual effect (Effect.expand).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
direction
class-attribute
instance-attribute
¶
direction: Literal['horizontal', 'vertical'] | Expression[str] | None = None
'horizontal' or 'vertical'.
style
class-attribute
instance-attribute
¶
style: Style | DynamicStyle | None = None
Style expanded outward from the center.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
ExplodeEffectParameters
dataclass
¶
ExplodeEffectParameters(force: float | Expression[int | float] | None = None, randomness: float | Expression[int | float] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.explode' visual effect (Effect.explode).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
force
class-attribute
instance-attribute
¶
force: float | Expression[int | float] | None = None
Outward force throwing the cells.
randomness
class-attribute
instance-attribute
¶
randomness: float | Expression[int | float] | None = None
Variation in force from cell to cell.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
FadeFromEffectParameters
dataclass
¶
FadeFromEffectParameters(foreground: ColorValue | Expression[ColorValue] | None = None, background: ColorValue | Expression[ColorValue] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.fade_from' visual effect (Effect.fade_from).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
foreground
class-attribute
instance-attribute
¶
foreground: ColorValue | Expression[ColorValue] | None = None
Starting foreground color, or None.
background
class-attribute
instance-attribute
¶
background: ColorValue | Expression[ColorValue] | None = None
Starting background color, or None.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration of the fade in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
FadeToEffectParameters
dataclass
¶
FadeToEffectParameters(foreground: ColorValue | Expression[ColorValue] | None = None, background: ColorValue | Expression[ColorValue] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.fade_to' visual effect (Effect.fade_to).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
foreground
class-attribute
instance-attribute
¶
foreground: ColorValue | Expression[ColorValue] | None = None
Target foreground color, or None.
background
class-attribute
instance-attribute
¶
background: ColorValue | Expression[ColorValue] | None = None
Target background color, or None.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration of the fade in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
GlitchEffectParameters
dataclass
¶
GlitchEffectParameters(ratio: float | Expression[int | float] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, start_delay_milliseconds: tuple[int, int] = (0, 0), action_milliseconds: tuple[int, int] = (50, 150), key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.glitch' visual effect (Effect.glitch).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
ratio
class-attribute
instance-attribute
¶
ratio: float | Expression[int | float] | None = None
Fraction of cells affected by the glitch.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
start_delay_milliseconds
class-attribute
instance-attribute
¶
(minimum, maximum) delay before a cell glitches.
action_milliseconds
class-attribute
instance-attribute
¶
(minimum, maximum) duration of each cell glitch.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
HighPassAudioEffectParameters
dataclass
¶
Bases: AudioEffectParameters
The parameters of the 'audio.high_pass' sound effect.
Attributes:
-
cutoff(float) –Corner frequency in hertz (
20.0to20000.0). -
resonance(float) –Filter resonance Q (
0.1to20.0).
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The
TerminalAudioEffectthis effect builds. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
cutoff
class-attribute
instance-attribute
¶
cutoff: float = 400.0
Corner frequency in hertz (20.0 to 20000.0).
resonance
class-attribute
instance-attribute
¶
resonance: float = 0.707
Filter resonance Q (0.1 to 20.0).
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> TerminalAudioEffect
The TerminalAudioEffect this effect builds.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
HslShiftEffectParameters
dataclass
¶
HslShiftEffectParameters(foreground: HslShiftTuple | None = None, background: HslShiftTuple | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.hsl_shift' visual effect (Effect.hsl_shift).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
foreground
class-attribute
instance-attribute
¶
(hue, saturation, lightness) shift for foreground colors.
background
class-attribute
instance-attribute
¶
(hue, saturation, lightness) shift for background colors.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
LightenEffectParameters
dataclass
¶
LightenEffectParameters(foreground: float | Expression[int | float] | None = None, background: float | Expression[int | float] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.lighten' visual effect (Effect.lighten).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
foreground
class-attribute
instance-attribute
¶
foreground: float | Expression[int | float] | None = None
Foreground lightness increase, or None.
background
class-attribute
instance-attribute
¶
background: float | Expression[int | float] | None = None
Background lightness increase, or None.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
LowPassAudioEffectParameters
dataclass
¶
Bases: AudioEffectParameters
The parameters of the 'audio.low_pass' sound effect.
Attributes:
-
cutoff(float) –Corner frequency in hertz (
20.0to20000.0). -
resonance(float) –Filter resonance Q (
0.1to20.0).
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The
TerminalAudioEffectthis effect builds. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
cutoff
class-attribute
instance-attribute
¶
cutoff: float = 1200.0
Corner frequency in hertz (20.0 to 20000.0).
resonance
class-attribute
instance-attribute
¶
resonance: float = 0.707
Filter resonance Q (0.1 to 20.0).
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> TerminalAudioEffect
The TerminalAudioEffect this effect builds.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
PaintEffectParameters
dataclass
¶
PaintEffectParameters(foreground: ColorValue | Expression[ColorValue] | None = None, background: ColorValue | Expression[ColorValue] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.paint' visual effect (Effect.paint).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
foreground
class-attribute
instance-attribute
¶
foreground: ColorValue | Expression[ColorValue] | None = None
Foreground color to paint, or None.
background
class-attribute
instance-attribute
¶
background: ColorValue | Expression[ColorValue] | None = None
Background color to paint, or None.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
PlayableEffectProperties
¶
Bases: _PlayableEffectMethods
The sound effects of a canvas's audio, one method for each effect.
Get it from Speaker.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:
-
active(tuple[PlayableEffect, ...]) –The effects added here and not cleared or replaced.
Examples:
import xnano
with xnano.new(width=8, height=1) as canvas:
echo = canvas.speaker.fx.delay(time_milliseconds=120.0, feedback=0.4)
assert canvas.speaker.fx.active == (echo,)
canvas.speaker.play('C4')
canvas.speaker.fx.clear()
assert canvas.speaker.fx.active == ()
Create the sound effects of a canvas's audio. Use canvas.speaker.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
cutoffand soften those above it. -
high_pass–Keep the frequencies above
cutoffand 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/effects/_properties.py
active
property
¶
active: tuple[PlayableEffect, ...]
The effects added here and not cleared or replaced.
bit_crush
¶
bit_crush(**parameters: Unpack[BitCrushAudioEffectParametersSchema]) -> BitCrushAudioEffectParameters
Lower the resolution of the sound, for a gritty, retro tone.
Other Parameters:
-
bits(int) –Quantization resolution in bits (
1to16). -
downsample(int) –Sample-hold factor (
1to256).
Returns:
-
BitCrushAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def bit_crush(
self, **parameters: Unpack[BitCrushAudioEffectParametersSchema]
) -> BitCrushAudioEffectParameters:
"""
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(
'BitCrushAudioEffectParameters', self._start('audio.bit_crush', parameters)
)
distortion
¶
distortion(**parameters: Unpack[DistortionAudioEffectParametersSchema]) -> DistortionAudioEffectParameters
Distort the sound by driving it into soft clipping.
Other Parameters:
-
drive(float) –Input gain before soft-clipping (
0.1to100.0).
Returns:
-
DistortionAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def distortion(
self, **parameters: Unpack[DistortionAudioEffectParametersSchema]
) -> DistortionAudioEffectParameters:
"""
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(
'DistortionAudioEffectParameters', self._start('audio.distortion', parameters)
)
low_pass
¶
low_pass(**parameters: Unpack[LowPassAudioEffectParametersSchema]) -> LowPassAudioEffectParameters
Keep the frequencies below cutoff and soften those above it.
Other Parameters:
-
cutoff(float) –Corner frequency in hertz (
20.0to20000.0). -
resonance(float) –Filter resonance Q (
0.1to20.0).
Returns:
-
LowPassAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def low_pass(
self, **parameters: Unpack[LowPassAudioEffectParametersSchema]
) -> LowPassAudioEffectParameters:
"""
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(
'LowPassAudioEffectParameters', self._start('audio.low_pass', parameters)
)
high_pass
¶
high_pass(**parameters: Unpack[HighPassAudioEffectParametersSchema]) -> HighPassAudioEffectParameters
Keep the frequencies above cutoff and soften those below it.
Other Parameters:
-
cutoff(float) –Corner frequency in hertz (
20.0to20000.0). -
resonance(float) –Filter resonance Q (
0.1to20.0).
Returns:
-
HighPassAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def high_pass(
self, **parameters: Unpack[HighPassAudioEffectParametersSchema]
) -> HighPassAudioEffectParameters:
"""
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(
'HighPassAudioEffectParameters', self._start('audio.high_pass', parameters)
)
delay
¶
delay(**parameters: Unpack[DelayAudioEffectParametersSchema]) -> DelayAudioEffectParameters
Repeat the sound as fading echoes.
Other Parameters:
-
time_milliseconds(float) –Delay time between echoes in milliseconds (
1.0to2000.0). -
feedback(float) –Echo feedback ratio (
0.0to0.95). -
mix(float) –Wet/dry mix ratio (
0.0to1.0).
Returns:
-
DelayAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def delay(
self, **parameters: Unpack[DelayAudioEffectParametersSchema]
) -> DelayAudioEffectParameters:
"""
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('DelayAudioEffectParameters', self._start('audio.delay', parameters))
reverb
¶
reverb(**parameters: Unpack[ReverbAudioEffectParametersSchema]) -> ReverbAudioEffectParameters
Add the reverberation of a room.
Other Parameters:
-
room(float) –Room size (
0.0to1.0). -
damping(float) –High-frequency damping (
0.0to1.0). -
mix(float) –Wet/dry mix ratio (
0.0to1.0).
Returns:
-
ReverbAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def reverb(
self, **parameters: Unpack[ReverbAudioEffectParametersSchema]
) -> ReverbAudioEffectParameters:
"""
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(
'ReverbAudioEffectParameters', self._start('audio.reverb', parameters)
)
tremolo
¶
tremolo(**parameters: Unpack[TremoloAudioEffectParametersSchema]) -> TremoloAudioEffectParameters
Pulse the volume up and down.
Other Parameters:
-
rate_hertz(float) –Modulation rate in hertz (
0.1to40.0). -
depth(float) –Modulation depth (
0.0to1.0).
Returns:
-
TremoloAudioEffectParameters–The effect. Assigning one of its fields changes the sounds played after that.
Source code in xnano/effects/_properties.py
def tremolo(
self, **parameters: Unpack[TremoloAudioEffectParametersSchema]
) -> TremoloAudioEffectParameters:
"""
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(
'TremoloAudioEffectParameters', self._start('audio.tremolo', parameters)
)
clear
¶
ReverbAudioEffectParameters
dataclass
¶
Bases: AudioEffectParameters
The parameters of the 'audio.reverb' sound effect.
Attributes:
-
room(float) –Room size (
0.0to1.0). -
damping(float) –High-frequency damping (
0.0to1.0). -
mix(float) –Wet/dry mix ratio (
0.0to1.0).
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The
TerminalAudioEffectthis effect builds. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
damping
class-attribute
instance-attribute
¶
damping: float = 0.5
High-frequency damping (0.0 to 1.0).
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> TerminalAudioEffect
The TerminalAudioEffect this effect builds.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
SaturateEffectParameters
dataclass
¶
SaturateEffectParameters(foreground: float | Expression[int | float] | None = None, background: float | Expression[int | float] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.saturate' visual effect (Effect.saturate).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
foreground
class-attribute
instance-attribute
¶
foreground: float | Expression[int | float] | None = None
Foreground saturation change, or None.
background
class-attribute
instance-attribute
¶
background: float | Expression[int | float] | None = None
Background saturation change, or None.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
SleepEffectParameters
dataclass
¶
SleepEffectParameters(duration_milliseconds: int | Expression[int | float] = 500, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.sleep' visual effect (Effect.sleep).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] = 500
Pause duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
SlideInEffectParameters
dataclass
¶
SlideInEffectParameters(direction: MotionDirection | Expression[str] | None = None, gradient_length: int | Expression[int | float] | None = None, randomness: int | Expression[int | float] | None = None, color: ColorValue | Expression[ColorValue] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.slide_in' visual effect (Effect.slide_in).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
direction
class-attribute
instance-attribute
¶
direction: MotionDirection | Expression[str] | None = None
Slide direction (such as 'left_to_right').
gradient_length
class-attribute
instance-attribute
¶
gradient_length: int | Expression[int | float] | None = None
Length of the gradient trail in cells.
randomness
class-attribute
instance-attribute
¶
randomness: int | Expression[int | float] | None = None
Random offset across rows or columns.
color
class-attribute
instance-attribute
¶
color: ColorValue | Expression[ColorValue] | None = None
Color behind the sliding cells.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
SlideOutEffectParameters
dataclass
¶
SlideOutEffectParameters(direction: MotionDirection | Expression[str] | None = None, gradient_length: int | Expression[int | float] | None = None, randomness: int | Expression[int | float] | None = None, color: ColorValue | Expression[ColorValue] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.slide_out' visual effect (Effect.slide_out).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
direction
class-attribute
instance-attribute
¶
direction: MotionDirection | Expression[str] | None = None
Slide direction (such as 'left_to_right').
gradient_length
class-attribute
instance-attribute
¶
gradient_length: int | Expression[int | float] | None = None
Length of the gradient trail in cells.
randomness
class-attribute
instance-attribute
¶
randomness: int | Expression[int | float] | None = None
Random offset across rows or columns.
color
class-attribute
instance-attribute
¶
color: ColorValue | Expression[ColorValue] | None = None
Color left behind the sliding cells.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
StretchEffectParameters
dataclass
¶
StretchEffectParameters(direction: MotionDirection | Expression[str] | None = None, style: Style | DynamicStyle | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.stretch' visual effect (Effect.stretch).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
direction
class-attribute
instance-attribute
¶
direction: MotionDirection | Expression[str] | None = None
'left_to_right', 'right_to_left', 'up_to_down' or 'down_to_up'.
style
class-attribute
instance-attribute
¶
style: Style | DynamicStyle | None = None
Style stretched across the area.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
SweepInEffectParameters
dataclass
¶
SweepInEffectParameters(direction: MotionDirection | Expression[str] | None = None, gradient_length: int | Expression[int | float] | None = None, randomness: int | Expression[int | float] | None = None, color: ColorValue | Expression[ColorValue] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.sweep_in' visual effect (Effect.sweep_in).
Attributes:
-
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.
Methods:
-
evaluate–Compute the expression's value.
-
then–An operation that applies this operation, then
other. -
when–An operation that applies only while
conditionis true. -
kinds–The name of every kind of customization.
-
defaults–The parameter names of a kind with their defaults, in order.
-
build–The core object this customization stands for: a
Style,Border,Effect, -
to_operation–The core operation that applies this customization.
-
to_audio_effect–The audio effect behind an
'audio.*'customization. -
apply_to_surface–Apply this customization to a buffer, widget or region.
-
apply_to–Apply this operation to a canvas, placement or surface.
-
cancel–Stop this effect on the target it was applied to.
parameters
property
¶
The parameters by name, with defaults filled in.
direction
class-attribute
instance-attribute
¶
direction: MotionDirection | Expression[str] | None = None
Sweep direction (such as 'left_to_right').
gradient_length
class-attribute
instance-attribute
¶
gradient_length: int | Expression[int | float] | None = None
Length of the sweep gradient in cells.
randomness
class-attribute
instance-attribute
¶
randomness: int | Expression[int | float] | None = None
Random offset across rows or columns.
color
class-attribute
instance-attribute
¶
color: ColorValue | Expression[ColorValue] | None = None
Starting sweep color.
duration_milliseconds
class-attribute
instance-attribute
¶
duration_milliseconds: int | Expression[int | float] | None = None
Duration in milliseconds.
interpolation
class-attribute
instance-attribute
¶
interpolation: Interpolation | Expression[str] | None = None
The easing curve, such as 'linear' or 'quad_in_out'.
key
class-attribute
instance-attribute
¶
key: str | Expression[str] | None = None
Optional effect key for replacement or cancellation.
evaluate
¶
evaluate(context: EvaluationContext) -> ValueType_co
Compute the expression's value.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def evaluate(self, context: EvaluationContext) -> ValueType_co:
"""
Compute the expression's value.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
context = EvaluationContext(buffer=Buffer(width=5, height=1))
assert (width * 2).evaluate(context) == 10
```
"""
then
¶
when
¶
An operation that applies only while condition is true.
Examples:
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
def when(self, condition: Predicate) -> Operation:
"""
An operation that applies only while ``condition`` is true.
Examples:
```python
from xnano_core._xnano_core import _reference
width = _reference('Width', 'numeric_property')
buffer = Buffer(width=6, height=1)
buffer.update(Write('wide').when(width > 4))
assert buffer.text.startswith('wide')
```
"""
kinds
staticmethod
¶
The name of every kind of customization.
Examples:
defaults
staticmethod
¶
The parameter names of a kind with their defaults, in order.
Raises:
-
ValueError–kindis not a customization kind.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
build
¶
build() -> object
The core object this customization stands for: a Style, Border, Effect,
Block, Margin, audio effect and so on, with all of its own methods.
Examples:
Source code in packages/xnano-core/src/xnano_core/_xnano_core/__init__.pyi
to_operation
¶
to_operation() -> Operation
The core operation that applies this customization.
Raises:
-
TypeError–The kind is not applied as an operation, such as
'block'.
to_audio_effect
¶
to_audio_effect() -> object
The audio effect behind an 'audio.*' customization.
Raises:
-
TypeError–The kind is not an audio effect.
apply_to
¶
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it again, so the operation is a live handle on what it changed. A running effect is stopped and started again with the new values.
Parameters:
-
target(Canvas[object, object] | Placement[object, object] | Surface) –The target to apply the operation to.
Source code in xnano/_internal/_dynamic_operations.py
def apply_to(
self,
target: Canvas[object, object] | Placement[object, object] | _core.Surface,
) -> None:
"""
Apply this operation to a canvas, placement or surface.
It stays attached to the target: after this, assigning one of its fields applies it
again, so the operation is a live handle on what it changed. A running effect is
stopped and started again with the new values.
Args:
target: The target to apply the operation to.
"""
from xnano.canvas import Canvas
from xnano.layout._placement import Placement
self._attach(target)
if isinstance(target, (Placement, Canvas)):
target._buffer.update(self)
if self.customization_kind.startswith('effect.'):
target._canvas._record_effect(cast('EffectParameters', self), target)
elif isinstance(target, _core.Surface):
target.update(self)
cancel
¶
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a sound effect.
Examples:
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
Source code in xnano/effects/_properties.py
def cancel(self) -> None:
"""
Stop this effect on the target it was applied to.
Does nothing for an effect that was never applied or has already finished, and for a
sound effect.
Examples:
```python
import xnano
with xnano.new('hi', width=4, height=1) as canvas:
fade = xnano.effect('effect.fade_to', foreground='red', duration_milliseconds=5000)
fade.apply_to(canvas)
fade.cancel()
fade.cancel()
```
"""
target = self.__dict__.get('_target')
key = getattr(self, 'key', None)
if target is None or not isinstance(key, str):
return
if not self.customization_kind.startswith('effect.'):
return
surface = target._buffer if hasattr(target, '_buffer') else target
surface.update(_core.CancelEffect(key))
SweepOutEffectParameters
dataclass
¶
SweepOutEffectParameters(direction: MotionDirection | Expression[str] | None = None, gradient_length: int | Expression[int | float] | None = None, randomness: int | Expression[int | float] | None = None, color: ColorValue | Expression[ColorValue] | None = None, duration_milliseconds: int | Expression[int | float] | None = None, interpolation: Interpolation | Expression[str] | None = None, key: str | Expression[str] | None = None)
Bases: EffectParameters
The parameters of the 'effect.sweep_out' visual effect (Effect.sweep_out).
Attributes:
-
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(