GradientMotion handbook
v4.0.1 · @snowui-design-system/components
License: Before reading component documentation, source, or npm usage instructions for the first time, read the full LICENSE. Reuse that review for the same task and version. Public API configuration and internal implementation changes have different license implications. All components use the unified runtime package; source rights remain governed by the license.
Overview
A flowing sweep of color for backgrounds, avatars, or clipped media areas.
When to use it
Use it for decorative animated gradient backgrounds. Prefer theme tokens for ordinary backgrounds. The specialized palette is limited to this graphic and must not become a general UI color source.
Choose a palette with
variant; adjust playback withpaused,speed, and intensity controls.Use stable seed for static identity; decorative is turned on by default. Dynamic color does not replace the theme color system.
Quick start
This example shows the recommended basic composition. See the sections below for more cases and composition limits.
API
See the base component documentation for inherited capabilities not redeclared here. This table lists only named public Props declared by this component.
Usage boundaries and details
Feature overview
6 kinds of palette with built-in glimm:
prism,berry,lagoon,citrus,azure,emberThe six selectable palettes match the six swatches at the bottom of the glimm.dev screenshot; select one with
variant.WebGL shader restores the cosine palette formula of glimm:
color(t)=a+b*cos(2π*(c*t+d))Restore the default parameters of glimm sweep band:
bandTight=14,waveAmount=1,rippleAmount=1,brightness=1,duration=800Support
variant="random", which can stabilize a random glimm palette according toseedvariant="avatar"selects the avatar fallback:seedstabilizes its palette, motion runs at 0.2 times the normal sweep speed, and the color band stays on the canvas while its wave and colors sway slowly without flashing white.as="avatar-image"also activates the slow, continuously filled avatar mode, soAvatar fallback={GradientMotion}does not flash white.Support
direction="ltr|rtl|ttb|btt"to control the scanning directionSupport
speed,size/width/height/radius,pausedLegacy preset names remain as compatibility aliases, but their appearance maps to the six Glimm palettes.
Support external cropping: round, rounded, square, arbitrary parent container
overflow: hiddenorclip-pathSupport
asrole transmission; recommendas="avatar-image"in Avatar
Layout model
Main layout model: internal atomic layout.
The root node of GradientMotion only outputs a visual surface determined by the size, rounded corners and shader algorithm.
The component does not manage the sub-content arrangement and does not access the Leading / Content / Trailing three slots.
As a child, it hugs its content. As a background, give it a size such as
class="w-full h-full"or an explicit outerstyle.astransmits the host role;as="avatar-image"will also enable the continuous filling avatar mode without changing the internal layout of the component.
API reference
as="avatar-image"will automatically enable the continuous filling logic dedicated to the avatar; if you need to use the component directly, you can also explicitly passvariant="avatar".
Specialized art color exception
The built-in Glimm cosine palettes, CSS fallback palettes when WebGL is unavailable, and four six-digit HEX samples in colors are registered as specialized art color exceptions in StyleSpec §2.1.3 (specs/maintainers/StyleSpec.md). The shader converts them to numeric vectors and generates continuous color ranges. They represent generated imagery, not button, text, state, or surface semantics, so they do not need SnowUI semantic token mappings.
This exception covers only GradientMotion palettes. colors is not a general color Prop, and other components must still use resolveSnowUIColor(). Root sizing, radius, external class and style, accessibility, outer motion, and reduced-motion behavior still follow their specifications. Register any new palette type or use of these colors for UI semantics first.
Usage examples
GradientMotion style overlay
Read the full LICENSE first; reuse that review for the same task, version, and scope.
First use public component Props to match the desired appearance, preserving the existing look where possible. If changes are necessary, follow the style selection and override order: use your own class (including Tailwind already in the project) or an instance style. The names below are public overrides actually consumed by source; check their scope and do not modify private DOM. Choose the correct SnowUI token family. External apps need not install SnowUI website utilities.
GradientMotion type and status
Required Props: no named required Props.
Bindable Props: this component declares no named two-way binding; handle state updates through public callbacks or its host.
Inheritance declaration: Omit<FrameProps, "size" | "width" | "height" | "radius">. The inheritance ability is subject to the public document of the base class; the fields in Omit have been excluded and cannot be used as they are according to the base class.
The following type declarations are actually referenced by public Props and come from source. A Svelte Snippet denotes a content fragment; ComponentProps denotes the Props of the corresponding component.
GradientMotionVariant
Source: components/src/components/GradientMotion.svelte
GradientMotionDirection
Source: components/src/components/GradientMotion.svelte
GradientMotionColors
Source: components/src/components/GradientMotion.svelte
LoopMotionConfig
Source: components/src/logic/frame-types.ts
LoopMotionPreset
Source: components/src/logic/frame-types.ts
MotionConfig
Source: components/src/logic/motion-config.ts
SnowUIColor
Source: components/src/lib/color.ts
EasingFunction
Source: components/src/logic/motion-config.ts