Documentation ¶
Overview ¶
Package animate implements animations, easings and interpolaters.
Index ¶
- func ColorInterpolate(n comm.Float64Notifier, l ColorInterpolater) comm.ColorNotifier
- func FloatInterpolate(w comm.Float64Notifier, l FloatInterpolater) comm.Float64Notifier
- type Animation
- type Basic
- type ColorInterpolater
- type CubicBezierEase
- type FloatInterpolater
- type FloatLerp
- type LinearEase
- type PolyInEase
- type PolyInOutEase
- type PolyOutEase
- type RGBALerp
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorInterpolate ¶
func ColorInterpolate(n comm.Float64Notifier, l ColorInterpolater) comm.ColorNotifier
ColorInterpolate wraps n and returns a notifier with the corresponding interpolated colors.
func FloatInterpolate ¶
func FloatInterpolate(w comm.Float64Notifier, l FloatInterpolater) comm.Float64Notifier
FloatInterpolate wraps n and returns a notifier with the corresponding interpolated floats.
Types ¶
type Animation ¶
Animation is an interface that represents a float64 that changes over a fixed duration.
type Basic ¶
type Basic struct { Start float64 End float64 Ease FloatInterpolater Dur time.Duration // Duration }
Basic is an animation that goes from Start to End with duration Dur.
type ColorInterpolater ¶
ColorInterpolater represents an object that interpolates between colors given a float64 between 0-1.
type CubicBezierEase ¶
type CubicBezierEase struct {
X0, Y0, X1, Y1 float64
}
CubicBezierEase interpolates between 1-0 using a Cubic Bézier curve. The parameters are cubic control parameters. The curve starts at (0,0) going toward (x0,y0), and arrives at (1,1) coming from (x1,y1).
func (CubicBezierEase) Interpolate ¶
func (e CubicBezierEase) Interpolate(a float64) float64
Interpolate implements the Interpolater interface.
func (CubicBezierEase) Notifier ¶
func (e CubicBezierEase) Notifier(a comm.Float64Notifier) comm.Float64Notifier
Notifier is a convenience method around animate.FloatInterpolate(n, e).
type FloatInterpolater ¶
ColorInterpolater represents an object that interpolates between floats given a float64 between 0-1.
var ( DefaultEase FloatInterpolater = CubicBezierEase{0.25, 0.1, 0.25, 1} DefaultInEase FloatInterpolater = CubicBezierEase{0.42, 0, 1, 1} DefaultOutEase FloatInterpolater = CubicBezierEase{0, 0, 0.58, 1} DefaultInOutEase FloatInterpolater = CubicBezierEase{0.42, 0, 0.58, 1} )
type FloatLerp ¶
type FloatLerp struct {
Start, End float64
}
FloatLerp interpolates between Start and End linearly.
func (FloatLerp) Interpolate ¶
Interpolate implements the Interpolater interface.
func (FloatLerp) Notifier ¶
func (e FloatLerp) Notifier(a comm.Float64Notifier) comm.Float64Notifier
Notifier is a convenience method around animate.FloatInterpolate(n, e)
type LinearEase ¶
type LinearEase struct { }
LinearEase interpolates between 1-0 in a linear fashion.
func (LinearEase) Interpolate ¶
func (e LinearEase) Interpolate(a float64) float64
Interpolate implements the Interpolater interface.
func (LinearEase) Notifier ¶
func (e LinearEase) Notifier(a comm.Float64Notifier) comm.Float64Notifier
Notifier is a convenience method around animate.FloatInterpolate(n, e)
type PolyInEase ¶
type PolyInEase struct {
Exp float64
}
PolyInEase interpolates between Start and End with a polynomial easing.
func (PolyInEase) Interpolate ¶
func (e PolyInEase) Interpolate(a float64) float64
Interpolate implements the Interpolater interface.
func (PolyInEase) Notifier ¶
func (e PolyInEase) Notifier(a comm.Float64Notifier) comm.Float64Notifier
Notifier is a convenience method around animate.FloatInterpolate(n, e)
type PolyInOutEase ¶
PolyInOutEase interpolates between Start and End with a symmetric polynomial easing.
func (PolyInOutEase) Interpolate ¶
func (e PolyInOutEase) Interpolate(a float64) float64
Interpolate implements the Interpolater interface.
func (PolyInOutEase) Notifier ¶
func (e PolyInOutEase) Notifier(a comm.Float64Notifier) comm.Float64Notifier
Notifier is a convenience method around animate.FloatInterpolate(n, e)
type PolyOutEase ¶
type PolyOutEase struct {
Exp float64
}
PolyOutEase interpolates between Start and End with a reverse polynomial easing.
func (PolyOutEase) Interpolate ¶
func (e PolyOutEase) Interpolate(a float64) float64
Interpolate implements the Interpolater interface.
func (PolyOutEase) Notifier ¶
func (e PolyOutEase) Notifier(a comm.Float64Notifier) comm.Float64Notifier
Notifier is a convenience method around animate.FloatInterpolate(n, e)
type RGBALerp ¶
RGBALerp interpolates between colors Start and End.
func (RGBALerp) Interpolate ¶
Interpolate implements the ColorInterpolater interface
func (RGBALerp) Notifier ¶
func (e RGBALerp) Notifier(n comm.Float64Notifier) comm.ColorNotifier
Notifier is a convenience method around animate.ColorInterpolate(n, e)
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is an struct that runs Animations and emits float64s.
func (*Value) SetValue ¶
SetValue updates Value, calls any subscribed functions and cancels any running animations.