Documentation
¶
Index ¶
Constants ¶
View Source
const ( Start = Type("Start") Move = Type("Move") End = Type("End") EndInertia = Type("EndInertia") )
Variables ¶
View Source
var DefaultInertialMotion = InertialMotion{ InertiaExtinction: 0.1, SmoothingTimeout: 300 * time.Millisecond, InertiaDelay: 30 * time.Millisecond, }
Functions ¶
This section is empty.
Types ¶
type InertialMotion ¶
type InertialMotion struct {
// InertiaExtinction is the amount taken off the remaining internal motion on every
// call to the Damp() method. A value of e.g. 0.1 means that 10% is taken off.
InertiaExtinction float64
// SmoothingTimeout is the duration of the smoothing low pass filter.
SmoothingTimeout time.Duration
// InertiaDelay is the expected time between calls to Get to retrieve the
// remaining inertial motion.
InertiaDelay time.Duration
// contains filtered or unexported fields
}
func (*InertialMotion) Damp ¶
func (i *InertialMotion) Damp() *InertialMotion
Apply damping to slow the motion once the user has stopped dragging.
func (*InertialMotion) Get ¶
func (i *InertialMotion) Get() (dx, dy float64)
Get returns the residual inertial motion that occured in a period of duration InertiaMsecDelay. So it is expected to be called every InertiaMsecDelay milliseconds.
func (*InertialMotion) Reset ¶
func (i *InertialMotion) Reset()
Reset zeroes the residual inertial motion.
Click to show internal directories.
Click to hide internal directories.