ReferenceCustom effectsType
Live
A value that can change while an effect runs.
type Live<T> = T | (() => T);A value that can change while an effect runs: either a fixed value, or a function that party.js calls again each time it needs the value.
Use a function to follow something outside of the effect, for example the window size, the scroll position or an element that moves its position. Unlike a Sampler, the function receives no context. It is not about variety between particles, but rather about reacting to page state.
Type Parameters
Section titled “Type Parameters”T
Example
Section titled “Example”// Keep emitting from the center of the window, even when it's resized.const origin = () => ({ x: window.innerWidth / 2, y: window.innerHeight / 2 });