load static method

Future<ParallaxComponent<FlameGame>> load(
  1. Iterable<ParallaxData> dataList, {
  2. Vector2? baseVelocity,
  3. Vector2? velocityMultiplierDelta,
  4. ImageRepeat repeat = ImageRepeat.repeatX,
  5. Alignment alignment = Alignment.bottomLeft,
  6. LayerFill fill = LayerFill.height,
  7. Images? images,
  8. Vector2? position,
  9. Vector2? size,
  10. Vector2? scale,
  11. double? angle,
  12. Anchor? anchor,
  13. int? priority,
})

Note that this method only should be used if all of your layers should have the same layer arguments (how the images should be repeated, aligned and filled), otherwise load the ParallaxLayers individually and use the normal constructor.

load takes a list of ParallaxData of all the images and a size that you want to use in the parallax.

Optionally arguments for the baseVelocity and velocityMultiplierDelta can be passed in, baseVelocity defines what the base velocity of the layers should be and velocityMultiplierDelta defines how the velocity should change the closer the layer is (velocityMultiplierDelta ^ n, where n is the layer index). Arguments for how all the images should repeat (repeat), which edge it should align with (alignment), which axis it should fill the image on (fill) and images which is the image cache that should be used can also be passed in.

If no image cache is set, the global flame cache is used.

Implementation

static Future<ParallaxComponent> load(
  Iterable<ParallaxData> dataList, {
  Vector2? baseVelocity,
  Vector2? velocityMultiplierDelta,
  ImageRepeat repeat = ImageRepeat.repeatX,
  Alignment alignment = Alignment.bottomLeft,
  LayerFill fill = LayerFill.height,
  Images? images,
  Vector2? position,
  Vector2? size,
  Vector2? scale,
  double? angle,
  Anchor? anchor,
  int? priority,
}) async {
  return ParallaxComponent(
    parallax: await Parallax.load(
      dataList,
      size: size,
      baseVelocity: baseVelocity,
      velocityMultiplierDelta: velocityMultiplierDelta,
      repeat: repeat,
      alignment: alignment,
      fill: fill,
      images: images,
    ),
    position: position,
    size: size,
    scale: scale,
    angle: angle,
    anchor: anchor,
    priority: priority,
  );
}