A JOY GAMES EXPERIMENT
.joyfx
F
Particles use XYZ world space, with Y up in the perspective preview. Size is in world units; rotation and spin roll the camera-facing sprite. PARTICLE LAB uses its own deterministic language, not JavaScript.
Writable containers: position, velocity, and acceleration are vectors with .x, .y, .z components. color has .r, .g, .b, .a components.
position
velocity
acceleration
.x
.y
.z
color
.r
.g
.b
.a
Whole values: velocity = vector(0, 80, 0); color = rgba(1, 0.4, 0.1, 1); position = origin + vector(0, 10, 0); velocity += acceleration * dt; Component writes such as color.a = 1 - t; remain available.
velocity = vector(0, 80, 0);
color = rgba(1, 0.4, 0.1, 1);
position = origin + vector(0, 10, 0);
velocity += acceleration * dt;
color.a = 1 - t;
Writable scalars: drag, size, rotation, spin, lifetime, lightIntensity, lightRange, and u0–u3.
drag
size
rotation
spin
lifetime
lightIntensity
lightRange
u0
u3
u0–u3 are four custom numeric storage slots per particle. They start at zero and persist from spawn through updates; use them to remember an initial size, random phase, or other authored state. Local let values last only for that script invocation.
let
Read only: origin is the root or parent spawn position; parentVelocity is the parent's velocity at child birth (zero for roots). Both are vectors. Other inputs are dt, age, t, index, time, pi, tau, and named properties.
origin
parentVelocity
dt
age
t
index
time
pi
tau
Vector and color properties use the same component accessors, for example wind.x or tint.a, and can be copied whole: color = tint; Color properties use RGBA in 0–1; scripted particle RGB may exceed one for HDR brightness. Alpha is opacity. Optional lights inherit particle RGB and alpha.
wind.x
tint.a
color = tint;
0–1
Existing version-1 scalar spellings such as vx, alpha, originX, parentVx, and vector-property X/Y/Z suffixes remain readable for saved assets.
vx
alpha
originX
parentVx
X/Y/Z
Use let, assignments, += -= *= /=, and if (...) { ... } else { ... }. Operators: + - * / % ^ < > <= >= == != && || !.
+= -= *= /=
if (...) { ... } else { ... }
+ - * / % ^ < > <= >= == != && || !
Functions: sin, cos, tan, abs, sqrt, floor, ceil, round, exp, log, min, max, pow, atan2, clamp, mix, smoothstep, noise, rand, vector, and rgba.
sin
cos
tan
abs
sqrt
floor
ceil
round
exp
log
min
max
pow
atan2
clamp
mix
smoothstep
noise
rand
vector
rgba
Vectors/colors support same-type addition and subtraction, scalar multiplication and division, and mix(a, b, t). Assignments copy values. Conditions, comparisons, and other math functions use scalars.
mix(a, b, t)
Root emitters run their timeline. Trail and death links spawn particles directly from a child template, inherit parent velocity inputs, and stop after four child generations. Assets allow up to 4,096 live particles, 128 bursts per emitter, 30 seconds per timeline/lifetime, and bounded spawn work. Loops, arbitrary objects, strings, dynamic indexing, and browser or host calls are unavailable.