Documentation
¶
Index ¶
Constants ¶
View Source
const Delta = time.Second / 60
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnimPlayer ¶
type AnimPlayer struct {
// The frame of the animation currently being played
CurrentFrame *ebiten.Image
// The animation currently being played
CurrentAnimation *Animation
// Animations accessible by their Aseprite tag names
Animations map[string]*Animation
// Sprite atlas containing all animations
Atlas *ebiten.Image
// If true, the animation is paused
Paused bool
// contains filtered or unexported fields
}
AnimPlayer plays and manages Aseprite tag animations.
func NewAnimPlayerFromAsepriteFile ¶
func NewAnimPlayerFromAsepriteFile(asePath string) *AnimPlayer
The first Aseprite tag will be assigned as CurrentAnimation.
Do not read .ase/.aseprite files that do not have a tag.
func NewAnimPlayerFromAsepriteFileSystem ¶
func NewAnimPlayerFromAsepriteFileSystem(fs fs.FS, asePath string) *AnimPlayer
The first Aseprite tag will be assigned as CurrentAnimation.
Do not read .ase/.aseprite files that do not have a tag.
func (*AnimPlayer) IsEnded ¶ added in v1.4.0
func (a *AnimPlayer) IsEnded() bool
If Animation.Repeat is not zero, it returns true when the animation ends. If it is zero, it is always false.
func (*AnimPlayer) Play ¶ added in v1.4.0
func (a *AnimPlayer) Play(tag string)
Play rewinds and plays the animation.
func (*AnimPlayer) PlayIfNotCurrent ¶ added in v1.4.0
func (a *AnimPlayer) PlayIfNotCurrent(tag string)
PlayIfNotCurrent rewinds and plays the animation with the given tag if it's not already playing
func (*AnimPlayer) String ¶ added in v1.4.0
func (a *AnimPlayer) String() string
func (*AnimPlayer) Update ¶
func (a *AnimPlayer) Update(dt time.Duration)
type Animation ¶
type Animation struct {
// The animation tag name is identical to the Aseprite file
Tag string
// Animation frames
Frames []*ebiten.Image
// Frame durations retrieved from the Aseprite file
Durations []time.Duration
// Repeat specifies how many times the animation should loop.
// A value of 0 means infinite looping.
Repeat uint16
}
Animation for AnimPlayer
Click to show internal directories.
Click to hide internal directories.