Documentation
¶
Overview ¶
Spring driven scalars and rectangles for terminal motion
Index ¶
Constants ¶
const ( // Angular frequency that settles most moves in about a third of a second DefaultFrequency = 13.0 // Damping ratio that overshoots slightly before coming to rest DefaultDamping = 0.8 )
Variables ¶
var ( // Chrome that keeps up with the hand, settled in a quarter second without overshoot Snappy = Spring{Frequency: 18, Damping: 1} // Layout moves that land with a hint of overshoot Smooth = Spring{Frequency: DefaultFrequency, Damping: DefaultDamping} // Fades and veils that ease in without a bounce Gentle = Spring{Frequency: 10, Damping: 1} // Refusals that swing a few times before resting Rattle = Spring{Frequency: 36, Damping: 0.2} )
Functions ¶
This section is empty.
Types ¶
type Clock ¶
Schedules frames quickly while motion is active and slowly while the screen is at rest
func (*Clock) Accept ¶
Stamps a frame with its delta time, rejecting frames from stale schedules or other clocks
type FrameMsg ¶
Delivered once per animation frame with the seconds elapsed since the previous frame
type Rect ¶
type Rect struct {
X, Y, W, H Value
}
Box whose edges animate independently, with size springs that never overshoot
func (Rect) Cells ¶
Current box rounded to whole cells, the far edges rounded on their own so neither side jitters
type Value ¶
Scalar that eases toward its target with damped spring motion
func NewValueWith ¶
Builds a resting scalar that moves with the spring