GKController class

A controller that drives GK visual effects.

Extends AnimationController with time tracking, pointer position, intensity, and a convenient updateUniforms method for passing values to fragment shaders.

{@tool snippet}

final controller = GKController(
  vsync: this,
  duration: const Duration(seconds: 2),
  playMode: GKPlayMode.loop,
);
controller.play();

{@end-tool}

Inheritance

Constructors

GKController({required TickerProvider vsync, Duration? duration = const Duration(seconds: 1), GKPlayMode playMode = GKPlayMode.forward, double intensity = 1.0})
Creates a GKController.

Properties

animationBehavior → AnimationBehavior
The behavior of the controller when AccessibilityFeatures.disableAnimations is true.
finalinherited
debugLabel → String?
A label that is used in the toString output. Intended to aid with identifying animation controller instances in debug output.
finalinherited
duration ↔ Duration?
The length of time this animation should last.
getter/setter pairinherited
hashCode → int
The hash code for this object.
no setterinherited
intensity ↔ double
The effect intensity, clamped between 0.0 and 1.0.
getter/setter pair
isAnimating → bool
Whether this animation is currently animating in either the forward or reverse direction.
no setterinherited
isCompleted → bool
Whether this animation is stopped at the end.
no setterinherited
isDismissed → bool
Whether this animation is stopped at the beginning.
no setterinherited
isForwardOrCompleted → bool
Whether the current aim of the animation is toward completion.
no setterinherited
lastElapsedDuration → Duration?
The amount of time that has passed between the time the animation started and the most recent tick of the animation.
no setterinherited
lowerBound → double
The value at which this animation is deemed to be dismissed.
finalinherited
playMode ↔ GKPlayMode
The current playback mode.
getter/setter pair
pointerPosition → Offset
The current pointer position, normalized to 0.0–1.0 in both axes.
no setter
reverseDuration ↔ Duration?
The length of time this animation should last when going in reverse.
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
status → AnimationStatus
The current status of this animation.
no setterinherited
time → double
Elapsed time in seconds since the controller was created.
no setter
upperBound → double
The value at which this animation is deemed to be completed.
finalinherited
value ↔ double
The current value of the animation.
getter/setter pairinherited
velocity → double
The rate of change of value per second.
no setterinherited
view → Animation<double>
Returns an Animation<double> for this animation controller, so that a pointer to this object can be passed around without allowing users of that pointer to mutate the AnimationController state.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Calls the listener every time the value of the animation changes.
inherited
addStatusListener(AnimationStatusListener listener) → void
Calls listener every time the status of the animation changes.
inherited
animateBack(double target, {Duration? duration, Curve curve = Curves.linear}) → TickerFuture
Drives the animation from its current value to the given target, "backward".
inherited
animateBackWith(Simulation simulation) → TickerFuture
Drives the animation according to the given simulation with a status of AnimationStatus.reverse.
inherited
animateTo(double target, {Duration? duration, Curve curve = Curves.linear}) → TickerFuture
Drives the animation from its current value to the given target, "forward".
inherited
animateWith(Simulation simulation) → TickerFuture
Drives the animation according to the given simulation.
inherited
clearListeners() → void
Removes all listeners added with addListener.
inherited
clearStatusListeners() → void
Removes all listeners added with addStatusListener.
inherited
didRegisterListener() → void
Called immediately before a status listener is added via addStatusListener.
inherited
didUnregisterListener() → void
Called immediately after a status listener is removed via removeStatusListener.
inherited
dispose() → void
Release the resources used by this object. The object is no longer usable after this method is called.
inherited
drive<U>(Animatable<U> child) → Animation<U>
Chains a Tween (or CurveTween) to this Animation.
inherited
fling({double velocity = 1.0, SpringDescription? springDescription, AnimationBehavior? animationBehavior}) → TickerFuture
Drives the animation with a spring (within lowerBound and upperBound) and initial velocity.
inherited
forward({double? from}) → TickerFuture
Starts running this animation forwards (towards the end).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Calls all the listeners.
inherited
notifyStatusListeners(AnimationStatus status) → void
Calls all the status listeners.
inherited
play() → void
Starts playback according to the current playMode.
removeListener(VoidCallback listener) → void
Stop calling the listener every time the value of the animation changes.
inherited
removeStatusListener(AnimationStatusListener listener) → void
Stops calling the listener every time the status of the animation changes.
inherited
repeat({double? min, double? max, bool reverse = false, Duration? period, int? count}) → TickerFuture
Starts running this animation in the forward direction, and restarts the animation when it completes.
inherited
reset() → void
Sets the controller's value to lowerBound, stopping the animation (if in progress), and resetting to its beginning point, or dismissed state.
inherited
resync(TickerProvider vsync) → void
Recreates the Ticker with the new TickerProvider.
inherited
reverse({double? from}) → TickerFuture
Starts running this animation in reverse (towards the beginning).
inherited
stop({bool canceled = true}) → void
Stops running this animation.
inherited
toggle({double? from}) → TickerFuture
Toggles the direction of this animation, based on whether it isForwardOrCompleted.
inherited
toString() → String
A string representation of this object.
inherited
toStringDetails() → String
Provides a string describing the status of this object, but not including information about the object itself.
inherited
updatePointer(Offset globalPosition, Size widgetSize) → void
Updates the normalized pointer position from a global coordinate and widget size.
updateUniforms(FragmentShader shader) → void
Writes the standard uniforms to a FragmentShader.

Operators

operator ==(Object other) → bool
The equality operator.
inherited