Skip to content

1681-engine / index / Curve

Type Alias: Curve ​

ts
type Curve = 
  | number
  | {
  end: number;
  start: number;
}
  | readonly readonly [number, number][];

Defined in: src/particles/particleCurves.ts:11

Values that change over a particle's life, sampled at t from 0 (born) to 1 (gone). A curve is one of:

  • a number: the same the whole life;
  • { start, end }: a straight line between the two;
  • keyframes [[t, value], …] sorted by t: straight lines between them, held flat before the first and after the last (a puff that swells fast then fades slowly is three keys, not a custom function).

Pure and allocation-free: an emitter samples three curves per particle per frame.

Released under the MIT License.