Skip to content

Particle descriptors

Read as Markdown

import {
particleChoice,
particleCurve,
particleGradient,
particleInteger,
particleParameter,
particleRange,
} from "@pibbl/core/particles";

These direct, tree-shakable functions create immutable definition descriptors. They do not pick a value when called. The particle compiler assigns stable random channels, and the executor samples them from the system seed, emitter, particle ordinal, and property channel.

  • particleRange(min, max) describes a continuous inclusive range.
  • particleInteger(min, max) describes a safe-integer inclusive range.
  • particleChoice([{ value, weight }]) describes weighted selection.
  • particleParameter(name) references a typed effect parameter.
  • particleCurve(keys, options?) samples a scalar or two-dimensional value over normalized lifetime.
  • particleGradient(keys, options?) samples color over normalized lifetime.

Curves and gradients require strictly increasing keys covering 0 through 1. These APIs are particle-specific because their descriptors participate in deterministic channel compilation, parameter timing, and GPU lookup-table generation; they are not general random-number or interpolation utilities.

Types: PibblParticleRange, PibblParticleIntegerRange, PibblParticleChoice, PibblParticleParameterReference, PibblParticleCurve, and PibblParticleGradient.

Describes weighted choices sampled by a particle effect.

particleChoice: <const T>(choices: readonly Readonly<{ value: T; weight: number; }>[]) => PibblParticleChoice<T>

Related API: particleChoice, PibblParticleChoice.

  • choices — Nonempty weighted values; every weight and their total must be positive and finite.

An immutable descriptor containing copied choices. See PibblParticleChoice.

PibblParticleChoice

View source — packages/core/src/features/particles/lib/particle.ts:252

Describes keyframed scalar or vector values over normalized particle lifetime.

particleCurve: <const T extends PibblParticleCurveValue>(keys: readonly (readonly [time: number, value: T])[], options?: PibblParticleCurveOptions) => PibblParticleCurve<T>

Related API: particleCurve, PibblParticleCurveValue, PibblParticleCurveOptions, PibblParticleCurve.

  • keys — Scalar or 2D-vector keys with strictly increasing normalized times, starting at 0 and ending at 1.

  • options — Optional segment easing. See PibblParticleCurveOptions.

An immutable lifetime curve containing copied keys. See PibblParticleCurve.

PibblParticleCurveOptions

PibblParticleCurve

PibblParticleCurveValue

View source — packages/core/src/features/particles/lib/particle.ts:274

Describes keyframed colors over normalized particle lifetime.

particleGradient: (keys: readonly (readonly [time: number, color: string])[], options?: PibblParticleCurveOptions) => PibblParticleGradient

Related API: particleGradient, PibblParticleCurveOptions, PibblParticleGradient.

  • keys — Color keys with strictly increasing normalized times, starting at 0 and ending at

An immutable lifetime color gradient containing copied keys. See PibblParticleGradient .

PibblParticleCurveOptions

PibblParticleGradient

View source — packages/core/src/features/particles/lib/particle.ts:287

Describes a random integer range for particle sampling.

particleInteger: (min: number, max: number) => PibblParticleIntegerRange

Related API: particleInteger, PibblParticleIntegerRange.

  • min — Inclusive lower bound, a safe integer.

  • max — Inclusive upper bound; the inclusive span must be a safe integer.

An immutable integer sampling descriptor. See PibblParticleIntegerRange.

PibblParticleIntegerRange

View source — packages/core/src/features/particles/lib/particle.ts:242

References a named parameter declared by a particle effect.

particleParameter: <const Name extends string>(name: Name) => PibblParticleParameterReference<Name>

Related API: particleParameter, PibblParticleParameterReference.

  • name — Nonempty name of a parameter declared by the effect.

A typed parameter reference. See PibblParticleParameterReference.

PibblParticleParameterReference

View source — packages/core/src/features/particles/lib/particle.ts:261

Describes a continuous random range for particle sampling.

particleRange: (min: number, max: number) => PibblParticleRange

Related API: particleRange, PibblParticleRange.

  • min — Finite lower bound, no greater than max.

  • max — Finite upper bound; the span must also be finite.

An immutable continuous sampling descriptor. See PibblParticleRange.

PibblParticleRange

View source — packages/core/src/features/particles/lib/particle.ts:232

Read the Canvas particles companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.

Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.