XL constructor
- Key? key,
- required List<
Widget> layers, - Dragging dragging = const Dragging(),
- Normalization normalization = const Normalization(),
- Duration duration = const Duration(milliseconds: 250),
- Curve curve = Curves.ease,
- bool useLocalPosition = true,
- ReferencePosition referencePosition = ReferencePosition.center,
- VoidCallback? onPointerEnter,
- VoidCallback? onPointerExit,
- VoidCallback? onCompensation,
A Widget
that allows the definition of a stack of XLayer
s
and/or PLayer
s and that will intrinsically animate them
with a parallax effect based on sensor events (X
)
or pointer data (P
).
Layers
A list of XLayers and/or PLayers, each with their own animatable properties.
Sharing Input
If this XL
has both XLayer
s and PLayer
s, control the sharing of
sensors or pointer data with the opposing Layer
variety
with the respective flags:
Dragging
A parameter class that primarily pertains to PLayer
s and their
parallax animation during an active drag or pointer hover event.
Normalization
A parameter class that primarily pertain to XLayer
s
for customizing the intake of SensorEvent
data.
- Normalization.autocompensates, a flag for toggling autocompensation after steady sensor samples for some time
- Normalization.delay, how long to wait before kicking in
autocompensation, considering
sensitivity
to past samples in a buffer
Animation
The default duration and curve for this XL
's parallax animations
are controlled with these properties.
This applies when the layers are being transformed by sensor data or are resetting/autocompensating.
When PLayers are actively hovered/touched, Dragging applies instead.
Void Callbacks
For Function
performance on state-change:
onPointerEnter
onPointerExit
onCompensation
Implementation
const XL({
Key? key,
required this.layers,
this.sharesPointer = true,
this.sharesSensors = false,
this.dragging = const Dragging(),
this.normalization = const Normalization(),
this.duration = const Duration(milliseconds: 250),
this.curve = Curves.ease,
this.useLocalPosition = true,
this.referencePosition = ReferencePosition.center,
this.onPointerEnter,
this.onPointerExit,
this.onCompensation,
}) : super(key: key);