validate method

dynamic validate()

Implementation

validate() {
  var valid = true;

  var valueSize = getValueSize();
  if (valueSize - Math.floor(valueSize) != 0) {
    print('three.KeyframeTrack: Invalid value size in track. ${this}');
    valid = false;
  }

  var times = this.times, nKeys = times.length;

  if (nKeys == 0) {
    print('three.KeyframeTrack: Track is empty. ${this}');
    valid = false;
  }

  num? prevTime;

  for (var i = 0; i != nKeys; i++) {
    var currTime = times[i];

    if (prevTime != null && prevTime > currTime) {
      print('three.KeyframeTrack: Out of order keys.${this} i: $i currTime: $currTime prevTime: $prevTime');
      valid = false;
      break;
    }
    prevTime = currTime;
  }

  return valid;
}