LayerTimelineVisibility class
Controls layer visibility based on Layer.startTime / Layer.endTime relative to the current video time.
The animation progress is derived directly from the video position so that seeking immediately reflects the correct transition state (e.g. seeking to the middle of a 5 s fade-in shows the layer at 50 %).
When Layer.animations is not empty, the transition is phase-aware: each
animation drives a fade, slide, scale, wiggle, bounce, spin or flip during
the layer's enter window ([startTime, startTime + duration]) and/or exit
window ([endTime - duration, endTime]). Multiple animations are composed,
so the enter and leave phases can use distinct animation types — something
the single (child, animation) LayerTimelineConfigs.transitionBuilder
cannot express. The slide effect is edge-aware: using canvasSize and
layerCenter it pushes the layer just past the nearest canvas edge (rather
than by its own size), so even an off-center layer leaves the visible area
completely. A LayerAnimation.slideFrom point replaces that edge with a
start position of the caller's own, measured like Layer.offset. The scale
effect is anchored on the layer's visual center (via
layerFractionalOffset) so that a combined slide + scale enters straight
instead of drifting diagonally. A wiggle tilts the layer around the same
center, and a bounce lifts it by a multiple of its height, measured on the
box around the rotated layer as the exported image is. A spin turns it
around that center too, and a flip squeezes it across the axis it turns
around before anything turns it. A AnimationPhase.loop repeats for as
long as the layer is visible. Text reveals are drawn by the text layer
itself. When Layer.animations is empty, the legacy fade convenience
driven by Layer.enterDuration / Layer.exitDuration and the
LayerTimelineConfigs.transitionBuilder is used instead.
Layer.keyframes place the layer at every point of its time range. The widget's child is laid out at the layer's own placement, so the keyframed one is applied as the difference to it: the layer turns and scales around its visual center and moves by the difference in offset, and its opacity is the keyframes' own. The animations are composed on top of that, as the native renderer composes them on the keyframed placement, and so are the LayerKeyframe.effects between two keyframes while the playhead is there.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- LayerTimelineVisibility
Constructors
-
LayerTimelineVisibility({Key? key, required Layer layer, required ValueNotifier<
Duration> playTimeNotifier, required LayerTimelineConfigs configs, required Size canvasSize, required Offset layerCenter, Offset layerFractionalOffset = const Offset(-0.5, -0.5), required Widget child}) -
Creates a LayerTimelineVisibility.
const
Properties
- canvasSize → Size
-
The size of the editor canvas (in canvas coordinates, origin top-left).
final
- child → Widget
-
The layer widget to show/hide.
final
- configs → LayerTimelineConfigs
-
Animation configuration for the enter/exit transition.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- layer → Layer
-
The layer whose time range is evaluated.
final
- layerCenter → Offset
-
The layer's center in canvas coordinates (origin top-left).
final
- layerFractionalOffset → Offset
-
The fractional offset used to position the layer content within its
layout box (defaults to
Offset(-0.5, -0.5), centering the content).final -
playTimeNotifier
→ ValueNotifier<
Duration> -
Notifier that provides the current video playback position.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< LayerTimelineVisibility> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited