update method

void update()

Implementation

void update() {
  light.updateMatrixWorld(false);

  double coneLength = light.distance ?? 1000;
  final coneWidth = coneLength * math.tan(light.angle!);

  cone.scale.setValues(coneWidth, coneWidth, coneLength);

  spotLightHelperVector.setFromMatrixPosition(
      light.target!.matrixWorld);

  cone.lookAt(spotLightHelperVector);

  if (color != null) {
    cone.material!.color.setFromHex32(color!);
  }
  else {
    cone.material!.color.setFrom(light.color!);
  }
}