Best way to integrate animations frame by frame

Hi,

What would be the best way to create animations in Cabbage 2?

I store multiple frames in a folder:

I add the image in Cabbage:

image bounds(134, 298, 238, 115), file("assets/loop1/0001.png"), identChannel("vid1")

And refresh it:

kFPS     = 30          
kFrames  = 30          ; total number of frames

kTrig    metro kFPS

kIndex   init 1       

if kTrig == 1 then

Sfile sprintfk "assets/loop1/%04d.png", kIndex
chnset sprintfk("file(%s)", Sfile), "vid1"

kIndex += 1
if kIndex > kFrames then
kIndex = 1

endif

endif

It is working but I wonder if is efficient. Can this code be improved?

Thank you!

I wonder if using a png filmstrip would be more efficient (and I would use a slider instead of an image widget)

Yes, I think the second option would be best because you don’t need to construct a string each time. Then just set the slider value to update the frame. :+1: In Cabbage 3 you can just use CSS animations. I already tried a few and it’s wonderful :slight_smile:

Hi @rorywalsh , I’ve tried to implement it this way however active(0) seems to not deactivate the image drawn using rslider. I can still change the filmstrip value by clicking on the image and dragging the mouse down or up.

Is there something wrong with this line of code?

rslider  bounds(-30, -30, 480, 800), active(0), channel("background"), filmstrip("assets/base_filmstrip_proc.png", 100)

I am working with the pro Cabbage build 2.9.231, MacOS (I have a more recent Windows version but did not get the chance to try it).

Thank you!

As a workaround I add a transparent PNG on top of it, it’s definitely not clean but at least the user can’t interact with the filmstrip!

FYI here is a work in progress, we are still working on the knobs as you can see!

1 Like

I wan’t aware that active(0) doesn’t work for filmstrip sliders. I can take look, I’m glad you found a workaround though. Plugin looks and sounds great. What are you going to show in the display?

Thank you! This is the ‘subtle’ mode though so it sounds less extreme than the warm or the crushed mode. I like how it can help give more character to samples easily with a combination of filters, drive, exciters…

In the display we pre-rendered the name of the plugin moving depending on the dry-wet position. The ‘case’ of the plugin will also appear more and more burnt when you turn this knob. This becomes more extreme with the warm and crushed mode. It’s basically a visual indication of how the sound is being affected by the plugin (from subtle to very lofi/crushed). In ‘crushed’ mode the text will be super pixelated at maximum value.

I think it looks fun, is not super CPU intensive, and will look nice for users!

We’ll also add meters on the left and the right. The mockup we developed will be transparent so I will be able to place the meter behind the png.