These APIs allow you to display animation in a widget.
AnimatedFrames
ComponentThe AnimatedFrames
component allows you to display a frame animation in a widget by cycling through the provided child views as frames. The duration of the animation is customizable, and each frame corresponds to a view passed in as a child element.
duration
: DurationInSeconds
The animation duration, in seconds.
children
: VirtualNode[]
The array of views to toggle as the frames of the animation. Each child will be displayed sequentially during the animation.
AnimatedGif
ComponentThe AnimatedGif
component renders an animated GIF in a widget. You can provide a custom path to the GIF file, and optionally, a duration for the animation.
path
: string
The file path of the GIF image.
duration
: DurationInSeconds
(Optional)
The animation duration in seconds. If not provided, the default duration is used.
SwingAnimation
TypeThe SwingAnimation
type defines the configuration for animating a view in a swinging motion along the X and Y axes.
duration
: DurationInSeconds
The animation duration, in seconds.
distance
: number
The distance the view swings along the given axis.
ClockHandRotationEffectPeriod
TypeThe ClockHandRotationEffectPeriod
type is used to define the period of rotation for the clock hand effect. You can use predefined values like "hourHand"
, "minuteHand"
, or "secondHand"
, or provide a custom duration.
AnimatedImage
ComponentThe AnimatedImage
component renders an animated image in a widget. You can display either SFSymbol
images or UIImage
objects. The animation duration and content mode (fit or fill) can be customized.
systemImages
: (string | { name: string; variableValue: number })[]
(Optional)
An array of SFSymbol
names and variable values to display as a sequence of animated images.
images
: UIImage[]
(Optional)
An array of UIImage
objects to use as the animated frames.
contentMode
: ContentMode
(Optional)
A flag indicating whether the image should fit or fill the parent context. The default is "fit"
.
Possible values: "fit"
, "fill"
.
duration
: DurationInSeconds
The animation duration, in seconds.
SFSymbol
)UIImage
)CommonViewProps
TypeThis type defines common properties for views that support animation effects, including swing animations and clock hand rotation effects.
swingAnimation
: { x?: SwingAnimation, y?: SwingAnimation }
(Optional)
Defines the animation configuration for swinging the view along the X and/or Y axis. Each axis can have its own animation settings:
x
: The animation configuration for the horizontal axis.y
: The animation configuration for the vertical axis.clockHandRotationEffect
: ClockHandRotationEffectPeriod | { anchor: KeywordPoint | Point, period: ClockHandRotationEffectPeriod }
(Optional)
Defines the rotation effect for simulating a clock hand. You can specify the anchor point (optional) and the period (e.g., "hourHand"
, "minuteHand"
, "secondHand"
), or provide a custom duration for the rotation.