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
#Flipbook — Animation API (WIP 1.3.0~BETA)
1 messages · Page 1 of 1 (latest)
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)
animation
very true :3
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
updated the README a little, still working on it
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
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
ooh this is cool
thanks!! lemme know if you end up using it ^u^
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
i think the next thing i wanna add is randomness
random durations and random animation choice
this looks really cool!
I’ll probably use it if i ever need an animated joker!
YAY thanks!! ^u^
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
sick!
code is currently messy but i'll probably fix it up later