updateFrame method

void updateFrame(
  1. double viewWidth,
  2. double viewHeight
)

Implementation

void updateFrame(double viewWidth, double viewHeight){

  if(_finished){
    return;
  }

  // go left
  _x -= _factor;

  // go down
  _y += _factor;

  _trailPaint.shader = ui.Gradient.linear(
    Offset(_x, _y),
    Offset(_x + _trailLength, _y - _trailLength),
    <Color>[color, color.withOpacity(0.0)]
  );

  if (_x < (viewWidth * -0.5)) {
    listener.onMeteoriteComplete();
    _finished = true;
  }

}