RelativeKeyframe<T> class

A keyframe that animates from the previous keyframe's end value to a target.

This keyframe automatically uses the ending value of the previous keyframe as its starting point, animating to the specified target value.

Type Parameters

  • T - The type of value to animate.

Overview

Use RelativeKeyframe for smooth transitions between keyframes without explicitly specifying start values. If used as the first keyframe, it acts as a still keyframe.

Example

final timeline = TimelineAnimation<double>(
  keyframes: [
    AbsoluteKeyframe(Duration(milliseconds: 100), 0.0, 0.5),
    RelativeKeyframe(Duration(milliseconds: 100), 1.0), // from 0.5 to 1.0
  ],
);
Implemented types

Constructors

RelativeKeyframe(Duration duration, T target)
Creates a relative keyframe that animates to the target value.
const

Properties

duration Duration
The duration of this keyframe.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
target → T
The target value to animate to from the previous keyframe's end.
final

Methods

compute(TimelineAnimation<T> timeline, int index, double t) → T
Computes the value for this keyframe at the given progress.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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