tween

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InBack

func InBack(t, b, c, d float64) float64

InBack is a much like InQuint, but extends beyond the start away from end before snapping quickly to the end

func InBounce

func InBounce(t, b, c, d float64) float64

InBounce is a bouncing transition that slowly bounces away from start at increasing amounts before finally accelerating toward end

func InCirc

func InCirc(t, b, c, d float64) float64

InCirc is a circular transition based on the equation for half of a circle, taking the square root of t, that starts slow and speeds up

func InCubic

func InCubic(t, b, c, d float64) float64

InCubic is a cubic transition based on the cube of t that starts slow and speeds up

func InElastic

func InElastic(t, b, c, d float64) float64

InElastic is an elastic transition that wobbles around from the start value, extending past start and away from end, and then accelerates towards the end value at the end of the transition.

func InExpo

func InExpo(t, b, c, d float64) float64

InExpo is a exponential transition based on the 2 to power 10*t that starts slow and speeds up

func InOutBack

func InOutBack(t, b, c, d float64) float64

InOutBack is a much like InOutQuint, but extends beyond both start and end values on both sides of the transition

func InOutBounce

func InOutBounce(t, b, c, d float64) float64

InOutBounce is a bouncing transition that bounces off of the start value, then accelerates toward the average of start and end, then does the opposite toward the end value

func InOutCirc

func InOutCirc(t, b, c, d float64) float64

InOutCirc is a circular transition based on the equation for half of a circle, taking the square root of t, that starts and ends slow, accelerating through the middle

func InOutCubic

func InOutCubic(t, b, c, d float64) float64

InOutCubic is a cubic transition based on the cube of t that starts and ends slow, accelerating through the middle

func InOutElastic

func InOutElastic(t, b, c, d float64) float64

InOutElastic is an elastic transition that wobbles around from the start value, towards the middle of the transition extending beyond start away from end, then rapidly toward, and beyond end value, then wobbling toward end

func InOutExpo

func InOutExpo(t, b, c, d float64) float64

InOutExpo is a exponential transition based on the 2 to power 10*t that starts and ends slow, accelerating through the middle

func InOutQuad

func InOutQuad(t, b, c, d float64) float64

InOutQuad is a quadratic transition based on the square of t that starts and ends slow, accelerating through the middle

func InOutQuart

func InOutQuart(t, b, c, d float64) float64

InOutQuart is a quartic transition based on the fourth power of t that starts and ends slow, accelerating through the middle

func InOutQuint

func InOutQuint(t, b, c, d float64) float64

InOutQuint is a quintic transition based on the fifth power of t that starts and ends slow, accelerating through the middle

func InOutSine

func InOutSine(t, b, c, d float64) float64

InOutSine is a sinusoidal transition based on the cosine of t that starts and ends slow, accelerating through the middle

func InQuad

func InQuad(t, b, c, d float64) float64

InQuad is a quadratic transition based on the square of t that starts slow and speeds up

func InQuart

func InQuart(t, b, c, d float64) float64

InQuart is a quartic transition based on the fourth power of t that starts slow and speeds up

func InQuint

func InQuint(t, b, c, d float64) float64

InQuint is a quintic transition based on the fifth power of t that starts slow and speeds up

func InSine

func InSine(t, b, c, d float64) float64

InSine is a sinusoidal transition based on the cosine of t that starts slow and speeds up

func Linear

func Linear(t, b, c, d float64) float64

Linear is a linear interpolation of some t with respect to a total duration d between the values b and b+c

func OutBack

func OutBack(t, b, c, d float64) float64

OutBack is a much like OutQuint, but extends beyond the end away from start before easing toward end

func OutBounce

func OutBounce(t, b, c, d float64) float64

OutBounce is a bouncing transition that accelerates toward the end value and then bounces back slightly in decreasing amounts until coming to reset at end

func OutCirc

func OutCirc(t, b, c, d float64) float64

OutCirc is a circular transition based on the equation for half of a circle, taking the square root of t, that starts fast and slows down

func OutCubic

func OutCubic(t, b, c, d float64) float64

OutCubic is a cubic transition based on the cube of t that starts fast and slows down

func OutElastic

func OutElastic(t, b, c, d float64) float64

OutElastic is an elastic transition that accelerates quickly away from the start and beyond the end value and then wobbles towards the end value at the end of the transition.

func OutExpo

func OutExpo(t, b, c, d float64) float64

OutExpo is a exponential transition based on the 2 to power 10*t that starts fast and slows down

func OutInBack

func OutInBack(t, b, c, d float64) float64

OutInBack is a much like OutInQuint, but extends beyond the average of start and end during the middle of the transition

func OutInBounce

func OutInBounce(t, b, c, d float64) float64

OutInBounce is a bouncing transition that accelerates toward the average of start and end, bouncing off of the average toward start, then flips and bounces off of average toward end in increasing amounts before accelerating toward end

func OutInCirc

func OutInCirc(t, b, c, d float64) float64

OutInCirc is a circular transition based on the equation for half of a circle, taking the square root of t, that starts and ends fast, slowing through the middle

func OutInCubic

func OutInCubic(t, b, c, d float64) float64

OutInCubic is a cubic transition based on the cube of t that starts and ends fast, slowing through the middle

func OutInElastic

func OutInElastic(t, b, c, d float64) float64

OutInElastic is an elastic transition that accelerates towards and beyond the average of the start and end values, wobbles toward the average, wobbles out and slight away from end before accelerating toward the end value

func OutInExpo

func OutInExpo(t, b, c, d float64) float64

OutInExpo is a exponential transition based on the 2 to power 10*t that starts and ends fast, slowing through the middle

func OutInQuad

func OutInQuad(t, b, c, d float64) float64

OutInQuad is a quadratic transition based on the square of t that starts and ends fast, slowing through the middle

func OutInQuart

func OutInQuart(t, b, c, d float64) float64

OutInQuart is a quartic transition based on the fourth power of t that starts and ends fast, slowing through the middle

func OutInQuint

func OutInQuint(t, b, c, d float64) float64

OutInQuint is a quintic transition based on the fifth power of t that starts and ends fast, slowing through the middle

func OutInSine

func OutInSine(t, b, c, d float64) float64

OutInSine is a sinusoidal transition based on the sine or cosine of t that starts and ends fast, slowing through the middle

func OutQuad

func OutQuad(t, b, c, d float64) float64

OutQuad is a quadratic transition based on the square of t that starts fast and slows down

func OutQuart

func OutQuart(t, b, c, d float64) float64

OutQuart is a quartic transition based on the fourth power of t that starts fast and slows down

func OutQuint

func OutQuint(t, b, c, d float64) float64

OutQuint is a quintic transition based on the fifth power of t that starts fast and slows down

func OutSine

func OutSine(t, b, c, d float64) float64

OutSine is a sinusoidal transition based on the sine or cosine of t that starts fast and slows down

Types

type Group

type Group struct {
	// contains filtered or unexported fields
}

func (*Group) Add

func (g *Group) Add(t *Tween, val *float64)

func (*Group) Update

func (g *Group) Update(dt time.Duration) bool

type Sequence

type Sequence struct {
	// contains filtered or unexported fields
}

func NewSeq

func NewSeq(tweens ...*Tween) *Sequence

func (*Sequence) Reset

func (s *Sequence) Reset()

func (*Sequence) SetLoop

func (s *Sequence) SetLoop(loop bool)

func (*Sequence) Update

func (s *Sequence) Update(dt time.Duration) (float64, bool)

type Tween

type Tween struct {
	// contains filtered or unexported fields
}

func New

func New(begin, end float64, duration time.Duration, easing TweenFunc) *Tween

func (*Tween) Reset

func (t *Tween) Reset()

func (*Tween) SetLoop

func (t *Tween) SetLoop(loop bool)

func (*Tween) Update

func (t *Tween) Update(dt time.Duration) (float64, bool)

type TweenFunc

type TweenFunc func(t, b, c, d float64) float64

TweenFunc provides an interface used for the easing equation. You can use one of the provided easing functions or provide your own. t = current time, b = begin value, c = change from begin, d = duration

type Updater

type Updater interface {
	Update(dt time.Duration) (val float64, done bool)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL