Skip to content

World - Particles Module

anvil.api.world.particles

Particle effects, loaded from the project's assets/particles into a typed document.

Documentation reference

Particle

Bases: JsonFile[_ParticleDocument]

identifier property

The file's identifier.

name property

The identifier's name, without its namespace.

__init__(particle, component)

Create a particle with optional PBR texture set support.

Parameters:

Name Type Description Default
particle str

Name of the particle.

required
component TextureComponents

Texture components configuration for PBR.

required

__schema__() classmethod

The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with the file's type as title and where it is written under x-anvil-file.

Raises:

Type Description
TypeError

When the class is an abstract file base, with no document type.

Usage Example

from anvil.api.world.particles import Particle
from anvil.api.pbr.texture_set import TextureComponents

# Exports assets/particles/my_particle.particle.json and its texture my_particle_texture.png
Particle(
    "my_particle",
    TextureComponents(color="my_particle_texture")
).queue()