animate

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Overview

Package animate provides animation for GUIs built using the package goey.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAnimation

func AddAnimation(elem Element)

AddAnimation adds the element to the set of elements with active animations. As necessary, this function will arrange for the element to be updated with the time of the current animation frame so that its state can be updated.

This function should only be called from the GUI thread.

Types

type EaseLength

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

EaseLength encapsulates the calculations needs to smoothly vary a length.

func NewEaseLength

func NewEaseLength(newValue, oldValue base.Length) EaseLength

NewEaseLength creates a new ease to transition a length from the old value to the new value. The transition time will be the same as the constant DefaultTransitionTime.

func (*EaseLength) Done

func (e *EaseLength) Done(t Time) bool

Done returns true if the animation is completed at the specified time.

func (*EaseLength) Value

func (e *EaseLength) Value(t Time) base.Length

Value calculate the length as a function of time.

type Element

type Element interface {
	// AnimateFrame will be called for each frame to provide the element the
	// opportunity to modify its state.  The method should return true to
	// continue to receive callbacks.  Once the element's animations are
	// completed, it should return false.
	AnimateFrame(time Time) bool
}

An element that wishes to be animated must implement this interface.

type Time

type Time uint

Time represents an instant in time with millisecond precision.

const (

	// The default transition time is the default time for an animation.
	DefaultTransitionTime Time = defaultTransitionTime
)

func CurrentTime

func CurrentTime() Time

CurrentTime returns the time for the current animation frame. If no animations are currently running, it will return the current local time.

type Wipe

type Wipe struct {
	Child base.Widget
	Level int
}

Wipe provides an animation when changing its child widget.

func (*Wipe) Kind

func (*Wipe) Kind() *base.Kind

Kind returns the concrete type for use in the Widget interface. Users should not need to use this method directly.

func (*Wipe) Mount

func (w *Wipe) Mount(parent base.Control) (base.Element, error)

Mount creates a button control in the GUI. The newly created widget will be a child of the widget specified by parent.

Jump to

Keyboard shortcuts

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