ParticleCurve constructor

ParticleCurve(
  1. List<ParticleKeyframe> keyframes, {
  2. int resolution = 64,
})

Builds a curve from keyframes, baked into a resolution-entry table.

Keyframes need not be sorted; ties keep their relative order. An empty list is treated as a constant 0. resolution must be at least 2.

Implementation

ParticleCurve(List<ParticleKeyframe> keyframes, {this.resolution = 64})
  : assert(resolution >= 2),
    keyframes = List<ParticleKeyframe>.unmodifiable(
      [...keyframes]..sort((a, b) => a.t.compareTo(b.t)),
    ),
    _lut = Float32List(resolution) {
  _bake(this.keyframes);
}