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, *, color, normal=None, height=None, mer=None, mers=None)

A particle of the project, with its texture in assets/particles and its PBR maps. Each map is the name of an image in the same folder, or a color.

Particle("sparks", color="sparks", mer="sparks_mer").queue()

Parameters:

Name Type Description Default
particle str

Name of the particle.

required
color str

The texture's file name, without .png.

required
normal optional

The normal map. Not with height.

None
height optional

The height map. Not with normal.

None
mer optional

The metalness, emissive and roughness map. Not with mers.

None
mers optional

The MER map with subsurface scattering. Not with mer.

None

__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

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