Skip to content

sonolus.script.particle

Particle

Bases: Record

A particle effect.

is_available() -> bool

Check if the particle effect is available.

spawn(quad: QuadLike, duration: float, loop: bool = False) -> ParticleHandle

Spawn the particle effect.

Parameters:

Name Type Description Default
quad QuadLike

The quad to spawn the particle effect on.

required
duration float

The duration of the particle effect.

required
loop bool

Whether to loop the particle effect.

False

Returns:

Name Type Description
ParticleHandle ParticleHandle

A handle to the spawned particle effect.

ParticleHandle

Bases: Record

A handle to a looping particle effect.

destroy() -> None

Destroy the particle effect.

move(quad: QuadLike) -> None

Move the particle effect to a new location.

Parameters:

Name Type Description Default
quad QuadLike

The new quad to move the particle effect to.

required

StandardParticle

Standard particles.

particle(name: str) -> Any

Define a particle with the given name.

particles(cls: type[T]) -> T | Particles

Decorator to define particles.

Usage
@particles
class Particles:
    tap: StandardParticle.NOTE_CIRCULAR_TAP_RED
    other: Particle = particle("other")