Documentation
¶
Overview ¶
Package shimmer provides shimmer animation rendering for clog.
Index ¶
Constants ¶
const ( // Speed is the number of full gradient cycles per second. Speed = 0.5 // TickRate is the repaint interval when shimmer is active (~30fps). TickRate = 33 * time.Millisecond )
Variables ¶
This section is empty.
Functions ¶
func DefaultGradient ¶
DefaultGradient returns a wave-shaped gradient for shimmer effects: a subtle red-to-green-to-blue cycle that wraps seamlessly.
func Text ¶
Text renders each character of text with a gradient-interpolated foreground color, creating an animated shimmer when called with advancing phase values. Spaces are passed through unstyled. The caller must supply a pre-built LUT from BuildLUT. Passing a pre-built StyleLUT from BuildStyleLUT eliminates per-frame style allocations; pass nil to create styles on the fly.
Types ¶
type Config ¶ added in v0.11.0
Config holds resolved shimmer configuration.
func Apply ¶ added in v0.11.0
Apply returns a copy of DefaultConfig with all opts applied in order.
func DefaultConfig ¶ added in v0.11.0
func DefaultConfig() Config
DefaultConfig returns the default shimmer configuration.
type Direction ¶
type Direction int
Direction controls which way an animation travels.
const ( // Right moves the shimmer wave from left to right (default). Right Direction = iota // Left moves the shimmer wave from right to left. Left // MiddleIn sends the shimmer wave inward from both edges. MiddleIn // MiddleOut sends the shimmer wave outward from the center. MiddleOut // BounceIn sends the shimmer wave inward from both edges, then // bounces it back outward, creating a ping-pong effect. BounceIn // BounceOut sends the shimmer wave outward from the center, then // bounces it back inward, creating a ping-pong effect. BounceOut )
type LUT ¶
type LUT [lutSize]string
LUT is a pre-computed gradient lookup table of hex color strings.
type Option ¶
type Option func(*Config)
Option configures a Config.
func WithDirection ¶
WithDirection sets the direction the shimmer wave travels.
func WithGradient ¶
WithGradient sets custom gradient color stops.