setRendering method

  1. @override
Future setRendering(
  1. bool render
)
override

Set to true to continuously render the scene at the framerate specified by setFrameRate (60 fps by default).

Implementation

@override
Future setRendering(bool render) async {
  if (render && !_rendering) {
    _rendering = true;
    _renderLoop = Timer.periodic(Duration(microseconds: 16667), (_) {
      this.render();
    });
  } else if (!render && _rendering) {
    _rendering = false;
    _renderLoop?.cancel();
    _renderLoop = null;
  }
}