MotionSequence constructor

MotionSequence({
  1. required List<Motion> motions,
})

Creates a new motion with the list of motions passed in.

var mySequence = MotionSequence(
  motions: [myMotion0, myMotion1, myMotion2],
);

Implementation

MotionSequence({required List<Motion> motions}) {
  assert(motions.length >= 2);

  if (motions.length == 2) {
    // Base case
    _a = motions[0];
    _b = motions[1];
  } else {
    _a = motions[0];
    _b = MotionSequence(motions: motions.sublist(1));
  }

  // Calculate split and duration
  _duration = _a.duration + _b.duration;
  if (_duration > 0) {
    _split = _a.duration / _duration;
  } else {
    _split = 1.0;
  }
}