## Peachy - Aseprite animations

josh
Prole
Posts: 3
Joined: Fri Apr 06, 2018 8:38 am

### Peachy - Aseprite animations

Peachy is a parser/renderer for Aseprite animations in LÖVE. It lets you load the animation JSON and PNG spritesheet exports from Aseprite and draw them in LÖVE like so:

Code: Select all

local peachy = require("peachy")

-- Load an aseprite animation file called spinner.json, with the image
local spinner = peachy.new("spinner.json", love.graphics.newImage("spinner.png"), "Spin")

function love.draw()
spinner:draw(50, 50)
end

function love.update(dt)
spinner:update(dt)
end

You can have many animation tags in a single Aseprite export and switch between them. Supports forward, backward and ping-pong animations. Should also work fine with padded or trimmed exports.

Check main.lua in the root of the repository for an example.

GitHub repo: https://github.com/josh-perry/peachy
Docs: https://josh-perry.github.io/peachy/

Send me PRs.

Ikroth
Citizen
Posts: 70
Joined: Thu Jul 18, 2013 4:44 am

### Re: Peachy - Aseprite animations

Nice! I've been thinking about writing a tool just like this, but you beat me to the punch. I am looking forward to trying it out. We use Aseprite for a lot of our games but just use the regular spritesheets at the moment.

Nuthen224
Citizen
Posts: 50
Joined: Sun Jul 28, 2013 9:40 pm

### Re: Peachy - Aseprite animations

This is really cool. I notice the examples include the .aseprite files, and that the JSON files reference the .aseprite files too, but is it necessary to include them? Or is it possible for it to work with only the JSON and PNG spritesheet, without giving away the aseprite source file?

josh
Prole
Posts: 3
Joined: Fri Apr 06, 2018 8:38 am

### Re: Peachy - Aseprite animations

Nuthen224 wrote:
Thu May 17, 2018 10:37 pm
This is really cool. I notice the examples include the .aseprite files, and that the JSON files reference the .aseprite files too, but is it necessary to include them? Or is it possible for it to work with only the JSON and PNG spritesheet, without giving away the aseprite source file?
Yeah, the aseprite file isn't used at all. They're only in the repo for the sake of example and easy tinkering.

D0NM
Party member
Posts: 206
Joined: Mon Feb 08, 2016 10:35 am
Contact:

### Re: Peachy - Aseprite animations

This is a nice present for all Asesprite users. Good work, Josh!

May be I miss some options or notes here:
- How to play animation from certain frame?
- peachy:setTag (tag) <-- does it reset the animation to the 1st frame?

I cannot use it for some cut-scenes with a lot of long (not looped) animations which should be switched, restarted , etc... at certain moments.
Twitter @FaMeSoft / GP32 Free Platformer: SUPER PLUSHA
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua

josh
Prole
Posts: 3
Joined: Fri Apr 06, 2018 8:38 am

### Re: Peachy - Aseprite animations

D0NM wrote:
Sat May 19, 2018 7:34 pm
This is a nice present for all Asesprite users. Good work, Josh!

May be I miss some options or notes here:
- How to play animation from certain frame?
- peachy:setTag (tag) <-- does it reset the animation to the 1st frame?

I cannot use it for some cut-scenes with a lot of long (not looped) animations which should be switched, restarted , etc... at certain moments.
That's a good point. There should definitely be a setFrame function and maybe a second param on setTag to jump to a specific frame. Thanks!

Fyi: you can do this atm by calling peachyThing:setTag("MyTag") and then setting peachyThing.frameIndex to be the frame number, but it's undocumented.

D0NM
Party member
Posts: 206
Joined: Mon Feb 08, 2016 10:35 am
Contact:

### Re: Peachy - Aseprite animations

yes yes, I know how to work it around.
Also You've got an untold idea about the second optional param, too ))

keep it up.

------------
I'm going to teach children soon. And I look for solutions that are easy to understand and easy to start with.
e.g. kikito's anim8 is quite simple and cool,
but I do not want children to be stuck with grids, tiles and numbers. (I've had a bad experience with it.)
I need an application where u draw a sprite
then u load the sprite and play it with love2d.

PS In our own animation library we define the anchor point of the sprite.

What if the user of your library wants to set the center of the sprite to a certain point?
I dunno if Acesprite exports some meta data that could help the user to define such points right in the editor.
Twitter @FaMeSoft / GP32 Free Platformer: SUPER PLUSHA
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua

kirhgoff
Prole
Posts: 1
Joined: Sun Jun 03, 2018 5:03 am

### Re: Peachy - Aseprite animations

Hey, mate, awesome library!

I added small PR https://github.com/josh-perry/peachy/pull/6 - need width and height, let me know if you need any changes. Will be happy if you merge it!

D0NM
Party member
Posts: 206
Joined: Mon Feb 08, 2016 10:35 am
Contact:

### Re: Peachy - Aseprite animations

Just recorded a video lesson on peachy +aseprite (in Russian, sorry).