#Flipbook — Animation API (WIP 1.3.0~BETA)

1 messages · Page 1 of 1 (latest)

silver kite
#

This API mod allows you to animate the Jokers, Consumables, Vouchers, etc. in your Balatro mods!
If you only need simple animation, then SMODS already has tools for that. This mod adds more in-depth animation features, such as individual frame delays, frame ranges and animation states!
Check it out! https://github.com/GhostSalt/Flipbook

#

i'm working on a README, but am gonna finish it tomorrow

#

here's what i have right now:

Flipbook — Balatro Animation API

Introduction

Welcome to Flipbook! This API mod allows you to animate the Jokers, Consumables, Vouchers, etc. in your Balatro mods.

If you only need simple animation, then SMODS already has tools for that. This mod adds more in-depth animation features, such as individual frame delays, frame ranges and animation states.

Getting Started With Animation

Here is a simple animation for a Joker that changes between three sprites on 1 second intervals:

flipbook_anim = {
  { x = 0, y = 0, t = 1 },
  { x = 1, y = 0, t = 1 },
  { x = 2, y = 0, t = 1 }
}

x and y work similarly to pos. t is how long the frame is shown for, in seconds.

This is put on the Joker's object definition, alongside its other variables like key and pos. You can also animate Centers from the vanilla game or from other mods by using SMODS' take_ownership function, or by other means of adding code to Centers.

Ranges

The above animation can be simplified using the xrange field:

flipbook_anim = {
  { xrange = { first = 0, last = 2 }, y = 0, t = 1 }
}

If your animation has lots of frames within a range of x locations, xrange is a shorthand that allows you to code that in 1 line. first is the location in the range that will be shown first; last will be shown last.

t is the time that each frame individually will be shown, so this animation will last a total of 1 + 1 + 1 = 3 seconds.

You can also use yrange:

flipbook_anim = {
  { xrange = { first = 0, last = 2 }, yrange = { first = 0, last = 2 }, t = 1 }
}

This works similarly to xrange, but operates on y values instead. As shown in the code above, these two fields can be used together to save a lot of lines of code.

Note that you cannot currently specify individual frame durations when using xrange or yrange; t applies to all frames within range.

If first is less than last, the range will be in ascending order. However, if first is greater than last, the range will be in descending order:

flipbook_anim = {
  { xrange = { first = 2, last = 0 }, yrange = { first = 2, last = 0 }, t = 1 }
}

This is equivalent to:

flipbook_anim = {
  { x = 2, y = 2, t = 1 },
  { x = 1, y = 2, t = 1 },
  { x = 0, y = 2, t = 1 },
  { x = 2, y = 1, t = 1 },
  { x = 1, y = 1, t = 1 },
  { x = 0, y = 1, t = 1 },
  { x = 2, y = 0, t = 1 },
  { x = 1, y = 0, t = 1 },
  { x = 0, y = 0, t = 1 },
}

(README unfinished)

left temple
#

animation

silver kite
#

very true :3

silver kite
#

Flipbook — Animation API (WIP 1.1.0~BETA)

#

added six functions that you need to work with animation states

#

basically two functions, split into three kinds of like. thing ;u;

#

they allow you to change a card's anim state, and its anim extra states

silver kite
silver kite
#

i think the README is now done

#

-# well, done for now

#

-# i may have forgotten some things

#

hopefully this explains things well :3

#

Flipbook — Animation API (WIP 1.1.1~BETA)

#

added the cool new README, fixed a bug

#

oh ya, just note that you can't currently animate cards individually, animations happen at Center level

#

oh continuations don't seem to work properly right now

#

Flipbook — Animation API (WIP 1.1.2~BETA)

#

fixed looping being borked

silver kite
#

right so the code is a little messy to be honest

#

but, when is code not messy :3

silver kite
#

on release, i'm gonna change this mod's ID from GSFlipbook to Flipbook

#

it's been my standard for a while, but for an API mod, i feel like most people would expect the mod ID to be the mod name

mental pawn
#

ooh this is cool

silver kite
#

or, if you have any questions, or ideas

#

if you wanna do something with it that it can't currently do, i'm open to add it :3

silver kite
#

haven't forgotten about this thingy

#

i need to update the docs

silver kite
#

i think the next thing i wanna add is randomness

#

random durations and random animation choice

cursive maple
#

this looks really cool!
I’ll probably use it if i ever need an animated joker!

silver kite
#

YAY thanks!! ^u^

silver kite
#

flipbook now allows for each card to animate on its own ^u^

#

haven't pushed yet

#

will push when i release the next Phanta version

#

i also broke looping again 😭 hold on

#

i'd call that a success

mental pawn
#

sick!

silver kite
#

code is currently messy but i'll probably fix it up later

silver kite
#

Flipbook — Animation API (WIP 1.2.0~BETA)

#

the above things :3

#

i'll update the docs later, but this did change a couple things

#

so you might need to update your animation code

#

(probably not though)

silver kite
#

Flipbook — Animation API (WIP 1.3.0~BETA)

#

random frame durations are now possible!