ShapesGenerator.randomly constructor

ShapesGenerator.randomly({
  1. required double maxWidth,
  2. required double maxHeight,
  3. required bool enableXMovements,
  4. required bool enableYMovements,
  5. required double maxSize,
  6. required double minSize,
  7. required double maxOpacity,
  8. required double minOpacity,
  9. required List<ItemBehaviour> behaviours,
  10. required List<Color> colors,
  11. required double maxSpeed,
  12. required double minSpeed,
})

Implementation

ShapesGenerator.randomly({
  required this.maxWidth,
  required this.maxHeight,
  required this.enableXMovements,
  required this.enableYMovements,
  required this.maxSize,
  required this.minSize,
  required this.maxOpacity,
  required this.minOpacity,
  required List<ItemBehaviour> behaviours,
  required List<Color> colors,
  required this.maxSpeed,
  required this.minSpeed,
}) {
  this.behaviours = [];
  this.colors = [];
  for (ItemBehaviour b in behaviours) {
    this.behaviours.add(b);
    this.behaviours.add(b);
  }
  for (Color c in colors) {
    this.colors.add(c);
    this.colors.add(c);
  }

  this.colors.shuffle();
  this.behaviours.shuffle();
}