An open API service indexing awesome lists of open source software.

https://github.com/setanarut/aseplayer

Aseprite animation player for Ebitengine
https://github.com/setanarut/aseplayer

2d-graphics ase aseprite decoder ebiten ebitengine go golang parser player sprite-animation

Last synced: about 2 months ago
JSON representation

Aseprite animation player for Ebitengine

Awesome Lists containing this project

README

          

# aseplayer

Aseprite animation player for Ebitengine.

1. Layers are flattened, blending modes are applied, and frames are arranged on a single texture atlas. Invisible and reference layers are ignored.
2. Each [Tag](https://www.aseprite.org/docs/tags) is imported as an `Animation{}` struct and is ready to play.
- tags
3. AsePlayer supports three Animation Directions: `Forward`, `Ping-pong`, and `Reverse`.
- tag-properties
4. [Frame durations](https://www.aseprite.org/docs/frame-duration) are supported. The animation plays according to these durations.
5. One-time playback is not currently supported. Animations will always play in an infinite loop.

---

There are two methods available to read the file.

```Go
func NewAnimPlayerFromAsepriteFileSystem(fs fs.FS, asePath string) *AnimPlayer
func NewAnimPlayerFromAsepriteFile(asePath string) *AnimPlayer
```

## Usage

A pseudo-code

```Go
func (g *Game) Update() error {
if inpututil.IsKeyJustPressed(ebiten.KeyRight) {
g.myAnimPlayer.SetAnim("walk")
}
if inpututil.IsKeyJustPressed(ebiten.KeySpace) {
g.myAnimPlayer.SetAnim("jump")
}
g.myAnimPlayer.Update()
return nil
}

func (g *Game) Draw(s *ebiten.Image) {
s.DrawImage(g.myAnimPlayer.CurrentFrame, nil)
}
```