anim

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ANIMATIONTYPE_INT     = 0
	ANIMATIONTYPE_FLOAT   = 1
	ANIMATIONTYPE_VECTOR2 = 2

	//Repeat the animation incrementing using key value gradients.
	ANIMATIONLOOPMODE_RELATIVE = 0
	ANIMATIONLOOPMODE_CYCLE    = 1 //Restart the animation from initial value
	ANIMATIONLOOPMODE_CONSTANT = 2 //Pause the animation at the final value
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ANIMSTATUS

type ANIMSTATUS uint8
const (
	AnimstatusPlaying ANIMSTATUS = iota
	AnimstatusStop
)

type ANIMVALTYPE

type ANIMVALTYPE uint8
const (
	AnimValTypeInt ANIMVALTYPE = iota
	AnimValTypeFloat
	AnimValTypeVector2
)

type Anim

type Anim struct {
	Id   int
	Name string
	// contains filtered or unexported fields
}

func NewAnim

func NewAnim(name string, valtype ANIMVALTYPE, fps float64, totalframe int) *Anim

func (*Anim) AddKeyFrame

func (a *Anim) AddKeyFrame(frameindex int, frameval interface{}) *Anim

func (*Anim) Fps

func (a *Anim) Fps() float64

func (*Anim) Play

func (a *Anim) Play() *Anim

func (*Anim) SetLoop

func (a *Anim) SetLoop(isloop bool) *Anim

func (*Anim) SetOnPlayingListener

func (a *Anim) SetOnPlayingListener(playfuc func(int, interface{})) *Anim

func (*Anim) SetOnStopingListener

func (a *Anim) SetOnStopingListener(stopfuc func()) *Anim

func (*Anim) Status

func (a *Anim) Status() ANIMSTATUS

func (*Anim) Stop

func (a *Anim) Stop() *Anim

func (*Anim) Update

func (a *Anim) Update(delay float64) bool

type Animatable

type Animatable struct {
	FromFrame int
	ToFrame   int

	LoopAnimation        bool
	AnimationStartedDate int

	SpeedRatio float64
	// contains filtered or unexported fields
}

func NewAnimatable

func NewAnimatable(target IAnimationTarget, from int, to int, loop bool, speedRatio float64) *Animatable

func (*Animatable) Animate

func (this *Animatable) Animate(delay float64) bool

func (*Animatable) GetTarget

func (this *Animatable) GetTarget() IAnimationTarget

interface

type IAnimatable interface {
	GetTarget() IAnimationTarget
	Animate() bool
}

func (*Animatable) Init

func (this *Animatable) Init(target IAnimationTarget, from int, to int, loop bool, speedRatio float64)

type Animation

type Animation struct {
	Name string
	Id   int64

	FramePerSecond float64
	DataType       int
	LoopMode       int
	// contains filtered or unexported fields
}

func NewAnimation

func NewAnimation(name string, framePerSecond float64, dataType int, loopMode int) *Animation

loopmodel = -1

func (*Animation) Animate

func (this *Animation) Animate(target IAnimationTarget, delay float64, from int, to int, loop bool, speedRatio float64) bool

interface

type IAnimation interface {
	Animate(target IAnimationTarget, delay float64, from float64, to float64, loop bool, speedRatio float64) bool
}

func (*Animation) GetAnimId

func (this *Animation) GetAnimId() int64

func (*Animation) Init

func (this *Animation) Init(name string, framePerSecond float64, dataType int, loopMode int)

func (*Animation) SetEasingFunction

func (this *Animation) SetEasingFunction(easingFunc tools.IEasingFunction)

func (*Animation) SetKeys

func (this *Animation) SetKeys(values []*AnimationKeyFrame)

func (*Animation) SetOnErrorListener

func (this *Animation) SetOnErrorListener(errorfuc func(*Animation, error))

func (*Animation) SetOnPlayingListener

func (this *Animation) SetOnPlayingListener(playfuc func(*Animation, int, interface{}))

func (*Animation) SetOnStopingListener

func (this *Animation) SetOnStopingListener(stopfuc func(*Animation))

type AnimationKeyFrame

type AnimationKeyFrame struct {
	Frame int
	Value interface{} // Vector2 or Int or Float
}

type IAnimatable

type IAnimatable interface {
	GetTarget() IAnimationTarget
	Animate() bool
}

type IAnimation

type IAnimation interface {
	GetAnimId() int64
	Animate(target IAnimationTarget, delay float64, from int, to int, loop bool, speedRatio float64) bool
}

type IAnimationTarget

type IAnimationTarget interface {
	GetAnimations() []IAnimation
	GetAnimatables() []IAnimatable
}

Jump to

Keyboard shortcuts

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