#382
Animated gradient field
A KPI card on a gradient field whose hue and angle drift slowly through registered CSS custom properties; the pointer takes over and paints it.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "Animated gradient field" pattern (@codeatlasdev/ui demo #382, motion/hero-ambient) in my app.
Call get_demo({ ids: ["#382"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Hero backgrounds, dashboard headers and cards that need ambient color without video, canvas or a JavaScript loop.
Keep these library parts, with the props and tokens the demo uses:
- MotionStage from "@codeatlasdev/ui"
Behaviour to keep:
- `@property --hue` is a `<number>` and `@property --angle` is an `<angle>`, so CSS can interpolate them
- `animation: field-drift 9s ease-in-out infinite alternate` runs only while `m.playing && !driven`
- Keyframes: `from { --hue: 0; --angle: 135deg; }` to `to { --hue: 90; --angle: 315deg; }`
- Takeover: `hue` follows the pointer x (0 to 90) and `angle` follows y (0 to 360), written as `--hue` and `--angle`
- Reduced motion: `m.playing` is false, so nothing animates and the field stays at `135deg`
Exact motion (do not approximate):
- --hue, --angle (registered custom properties): 9s, ease-in-out
Reduced motion: the demo handles it; keep that branch.
Keyboard: not an interactive control.
Change only the copy and the data. Use the theme tokens (--ca-*), never raw colours. Library parts
- MotionStage
@codeatlasdev/ui
How it is built
- `@property --hue` is a `<number>` and `@property --angle` is an `<angle>`, so CSS can interpolate them
- `animation: field-drift 9s ease-in-out infinite alternate` runs only while `m.playing && !driven`
- Keyframes: `from { --hue: 0; --angle: 135deg; }` to `to { --hue: 90; --angle: 315deg; }`
- Takeover: `hue` follows the pointer x (0 to 90) and `angle` follows y (0 to 360), written as `--hue` and `--angle`
- Reduced motion: `m.playing` is false, so nothing animates and the field stays at `135deg`
Related
Loading source.