animation

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaStr = `` /* 453-byte string literal not displayed */
View Source
const TypeName = "animations"

Variables

This section is empty.

Functions

func LoadSchema

func LoadSchema() (*gojsonschema.Schema, error)

func SortFramesTopBottomLeftRight

func SortFramesTopBottomLeftRight(frameImages Images)

Types

type Animatable

type Animatable interface {
	UpdateAnimation(delta time.Duration)
}

Animatable is the component used in the animation system.

type Animations

type Animations struct {
	SpriteSetRef  string
	FrameDuration time.Duration

	TaggedImages map[string]Images
	Controller   *Controller
}

Animations organizes tagged frames from an image set into animations.

func NewAnimations

func NewAnimations(
	spriteSetRef string, frameDur time.Duration) *Animations

func (*Animations) Initialize

func (anims *Animations) Initialize(mgr resource.Manager) error

func (*Animations) MarshalJSON

func (anims *Animations) MarshalJSON() ([]byte, error)

func (*Animations) Start

func (anims *Animations) Start(tag string) bool

func (*Animations) UnmarshalJSON

func (anims *Animations) UnmarshalJSON(d []byte) error

type AnimationsJSON

type AnimationsJSON struct {
	SpriteSetRef  string `json:"spriteSetRef"`
	FrameDuration string `json:"frameDuration"`
}

type Controller

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

func NewController

func NewController() *Controller

func (*Controller) CurrentFrameImage

func (c *Controller) CurrentFrameImage() *ebiten.Image

func (*Controller) CurrentFrameIndex

func (c *Controller) CurrentFrameIndex() int

func (*Controller) CurrentFrameTag

func (c *Controller) CurrentFrameTag() string

func (*Controller) StartAnimation

func (c *Controller) StartAnimation(tag string, images Images, frameDur time.Duration) bool

func (*Controller) Update

func (c *Controller) Update(delta time.Duration)

type Frame

type Frame struct {
	Image    *ebiten.Image
	Duration time.Duration
}

type Images

type Images = []*ebiten.Image

func FrameImages

func FrameImages(tag string, sheet *sprite.Sheet) (Images, error)

type System

type System interface {
	Add(id string, x interface{})
	Remove(id string)
	Clear()

	Animate(deltaSec float64)
}

func NewSystem

func NewSystem() System

Directories

Path Synopsis
Package mock_animation is a generated GoMock package.
Package mock_animation is a generated GoMock package.

Jump to

Keyboard shortcuts

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