Documentation
¶
Overview ¶
Package anim is the animation engine: easing curves, springs, tweens that sample them at a monotonic time, and the per-event table the config builds. It imports only the standard library and the solvers in lys-lib/motion.
Index ¶
- Constants
- Variables
- func Builtins() map[string]Shape
- func DefaultMotion() map[Event]Setting
- func FrugalMotion() map[Event]Setting
- func GenieAlongX(from, to image.Rectangle) bool
- func Lerp(from, to, p float64) float64
- func LerpColor(from, to [4]uint8, p float64) [4]uint8
- func LerpRect(from, to image.Rectangle, p float64) image.Rectangle
- func Over(set, motion map[Event]Setting) map[Event]Setting
- func RubberBand(shown, delta, limit float64) float64
- type Bezier
- type Curve
- type Event
- type GenieStrip
- type Motion
- type Progress
- func (p *Progress) At(now time.Duration) float64
- func (p *Progress) Done(now time.Duration) bool
- func (p *Progress) Grab(now time.Duration)
- func (p *Progress) Projected(at time.Duration) float64
- func (p *Progress) Release(target float64, at, now time.Duration, c Curve)
- func (p *Progress) Set(target float64, now time.Duration, c Curve)
- func (p *Progress) Shift(by float64)
- func (p *Progress) Target() float64
- func (p *Progress) Track(to float64, at time.Duration)
- func (p *Progress) Tracking() bool
- func (p *Progress) Velocity(at time.Duration) float64
- type RectMotion
- func (m RectMotion) At(now time.Duration) image.Rectangle
- func (m RectMotion) Done(now time.Duration) bool
- func (m *RectMotion) Jump(to image.Rectangle)
- func (m *RectMotion) Set(to image.Rectangle, now time.Duration, c Curve)
- func (m RectMotion) Source() image.Rectangle
- func (m RectMotion) Target() image.Rectangle
- func (m RectMotion) Velocity(now time.Duration) [4]float64
- type Setting
- type Shape
- type Spring
- type Style
- type StyleKind
- type Table
- type Tween
- type Wobble
Constants ¶
const (
CommitAt = 0.5
)
const DefaultDuration = 250 * time.Millisecond
const FollowTolerance = 0.25
const (
GenieStrips = 64
)
const (
SettleTolerance = 1e-4
)
Variables ¶
var ( Linear = Bezier{motion.NewCubicBezier(0, 0, 1, 1)} Ease = Bezier{motion.NewCubicBezier(0.25, 0.1, 0.25, 1)} EaseIn = Bezier{motion.NewCubicBezier(0.42, 0, 1, 1)} EaseOut = Bezier{motion.NewCubicBezier(0, 0, 0.58, 1)} EaseInOut = Bezier{motion.NewCubicBezier(0.42, 0, 0.58, 1)} Smooth = mustSpring(170, 26) Wobbly = mustSpring(200, 10) )
Functions ¶
func DefaultMotion ¶
func FrugalMotion ¶
func GenieAlongX ¶
func RubberBand ¶
Types ¶
type GenieStrip ¶
func GenieLayout ¶
func GenieLayout(out []GenieStrip, from, to image.Rectangle, p float64) (strips []GenieStrip, alongX bool)
GenieLayout cuts from into strips across the direction to to lies in and places them at progress p, 0 at from and 1 at to: the strips nearest to set off first, sliding down a funnel that narrows from from's width to to's.
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
func NewProgress ¶
type RectMotion ¶
type RectMotion struct {
// contains filtered or unexported fields
}
func NewRectMotion ¶
func NewRectMotion(at image.Rectangle) RectMotion
func (*RectMotion) Jump ¶
func (m *RectMotion) Jump(to image.Rectangle)
func (RectMotion) Source ¶
func (m RectMotion) Source() image.Rectangle
func (RectMotion) Target ¶
func (m RectMotion) Target() image.Rectangle