LavaPainterData constructor

LavaPainterData({
  1. double width = 200.0,
  2. double widthTolerance = 0.0,
  3. bool growAndShrink = false,
  4. double growthRate = 20.0,
  5. double growthRateTolerance = 0.0,
  6. double blurLevel = 25.0,
  7. int numBlobs = 5,
  8. Color backgroundColor = Colors.transparent,
  9. required List<Color> colors,
  10. bool allSameColor = false,
  11. bool fadeBetweenColors = true,
  12. bool changeColorsTogether = false,
  13. double speed = 20.0,
  14. double speedTolerance = 0.0,
})

Creates a new LavaPainterData object.

A wave background is a background that has gently flowing sine waves that move across the screen in a certain direction.

Duration will not affect this painter in the same way it does others. The speed of the lava blobs is determined by the speed parameter. The speedTolerance parameter is used to give the lava blobs a bit of randomness in their movement speed. The duration will only affect the rate at which the blobs change color.

Implementation

LavaPainterData({
  this.width = 200.0,
  this.widthTolerance = 0.0,
  this.growAndShrink = false,
  this.growthRate = 20.0,
  this.growthRateTolerance = 0.0,
  this.blurLevel = 25.0,
  this.numBlobs = 5,
  this.backgroundColor = Colors.transparent,
  required List<Color> colors,
  this.allSameColor = false,
  this.fadeBetweenColors = true,
  this.changeColorsTogether = false,
  this.speed = 20.0,
  this.speedTolerance = 0.0,
})  : assert(width > 0.0),
      assert(width - widthTolerance > 0.0),
      assert(growthRate >= 0.0),
      assert(growthRate - growthRateTolerance >= 0.0),
      assert(blurLevel >= 0.0),
      assert(numBlobs > 0),
      assert(colors.isNotEmpty, true),
      assert(speed >= 0),
      assert(speed - speedTolerance >= 0),
      _colors = colors,
      _blobs = [] {
  for (int i = 0; i < numBlobs; i++) {
    _blobs.add(
      Lava(
        width: width,
        widthTolerance: widthTolerance,
        growAndShrink: growAndShrink,
        growthRate: growthRate,
        growthRateTolerance: growthRateTolerance,
        blurLevel: blurLevel,
        colors: colors,
        allSameColor: allSameColor,
        fadeBetweenColors: fadeBetweenColors,
        changeColorsTogether: changeColorsTogether,
        speed: speed,
        speedTolerance: speedTolerance,
      ),
    );
  }
}