Particle descriptors
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.
API details from source
Section titled “API details from source”
particleChoice
Section titled “particleChoice”Describes weighted choices sampled by a particle effect.
particleChoice: <const T>(choices: readonly Readonly<{ value: T; weight: number; }>[]) => PibblParticleChoice<T>Related API: particleChoice, PibblParticleChoice.
Parameters
Section titled “Parameters”choices— Nonempty weighted values; every weight and their total must be positive and finite.
Returns
Section titled “Returns”An immutable descriptor containing copied choices. See PibblParticleChoice.
See also
Section titled “See also”View source — packages/core/src/features/particles/lib/particle.ts:252
particleCurve
Section titled “particleCurve”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.
Parameters
Section titled “Parameters”-
keys— Scalar or 2D-vector keys with strictly increasing normalized times, starting at 0 and ending at 1. -
options— Optional segment easing. See PibblParticleCurveOptions.
Returns
Section titled “Returns”An immutable lifetime curve containing copied keys. See PibblParticleCurve.
See also
Section titled “See also”View source — packages/core/src/features/particles/lib/particle.ts:274
particleGradient
Section titled “particleGradient”Describes keyframed colors over normalized particle lifetime.
particleGradient: (keys: readonly (readonly [time: number, color: string])[], options?: PibblParticleCurveOptions) => PibblParticleGradientRelated API: particleGradient, PibblParticleCurveOptions, PibblParticleGradient.
Parameters
Section titled “Parameters”keys— Color keys with strictly increasing normalized times, starting at 0 and ending at
options— Optional segment easing. See PibblParticleCurveOptions.
Returns
Section titled “Returns”An immutable lifetime color gradient containing copied keys. See PibblParticleGradient .
See also
Section titled “See also”View source — packages/core/src/features/particles/lib/particle.ts:287
particleInteger
Section titled “particleInteger”Describes a random integer range for particle sampling.
particleInteger: (min: number, max: number) => PibblParticleIntegerRangeRelated API: particleInteger, PibblParticleIntegerRange.
Parameters
Section titled “Parameters”-
min— Inclusive lower bound, a safe integer. -
max— Inclusive upper bound; the inclusive span must be a safe integer.
Returns
Section titled “Returns”An immutable integer sampling descriptor. See PibblParticleIntegerRange.
See also
Section titled “See also”View source — packages/core/src/features/particles/lib/particle.ts:242
particleParameter
Section titled “particleParameter”References a named parameter declared by a particle effect.
particleParameter: <const Name extends string>(name: Name) => PibblParticleParameterReference<Name>Related API: particleParameter, PibblParticleParameterReference.
Parameters
Section titled “Parameters”name— Nonempty name of a parameter declared by the effect.
Returns
Section titled “Returns”A typed parameter reference. See PibblParticleParameterReference.
See also
Section titled “See also”PibblParticleParameterReference
View source — packages/core/src/features/particles/lib/particle.ts:261
particleRange
Section titled “particleRange”Describes a continuous random range for particle sampling.
particleRange: (min: number, max: number) => PibblParticleRangeRelated API: particleRange, PibblParticleRange.
Parameters
Section titled “Parameters”-
min— Finite lower bound, no greater than max. -
max— Finite upper bound; the span must also be finite.
Returns
Section titled “Returns”An immutable continuous sampling descriptor. See PibblParticleRange.
See also
Section titled “See also”View source — packages/core/src/features/particles/lib/particle.ts:232
Implementation guidance for agents
Section titled “Implementation guidance for agents”Read the Canvas particles companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.
Complete minimal examples
Section titled “Complete minimal examples”- Particle descriptors: Define randomized spawn values and lifespan curves. Plain source
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.