This is a GameComponent
Layer responsible for adding lighting to the game.
By setting the lightingColorGame
property on BonfireWidget you automatically enable this lighting system. To add light to objects, just add the Lighting
mixin to the component and configure it using setupLighting()
method:
class MyCustomDecoration extends GameDecoration with Lighting {
MyCustomDecoration(Position position)
: super.withAnimation(
Future<SpriteAnimation>(),
size: Vector2(32,32),
position: position,
){
setupLighting(
LightingConfig(
radius: width * 1.5,
color: Colors.transparent,
// blurBorder: 20, // this is a default value
// type: LightingType.circle, // this is a default value
// useComponentAngle: false, // this is a default value. When true light rotate together component when change `angle` param.
),
);
}
}
You can apply color filter in your game programmatically.
gameRef.colorFilter.animateTo(Colors.blue, BlendMode.colorBurn);