set_image_as_frame(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

πŸŽ€ set_image_as_frame(3) πŸŽ€

okay so this is a page from the Arcan Lua API manual, and bestie, it's genuinely such a cute little function. let's get into it πŸ’…


✨ NAME ✨

set_image_as_frame β€” literally just: specify the contents of a multi-frame object. that's the whole vibe. πŸ¦‹


✨ SYNOPSIS ✨

nil
set_image_as_frame( contvid, srcvid, index )

like yes, it returns nil. she's not here to give you anything back, she's here to do the thing. 😌


✨ DESCRIPTION ✨

okay so picture this: you've got an object, right? and you want it to have multiple frames β€” like a little flipbook. 🌸

the way you do that is by calling image_framesetsize, which allocates a static number of slots for attaching objects to. static!! meaning the count is set and that's that, no growing later, we love commitment ✨

by default, all of those slots just refer back to the source object. boring but valid. πŸ™ˆ but β€” and this is the main character moment β€” each individual slot can be filled with its own object using set_image_as_frame. iconic.

so contvid is the container, srcvid is the thing you're dropping into a slot, and index... well, you get it. 😌

the behavior and restrictions for srcvid are similar to image_sharestorage, with one lil bonus: the texture coordinate set in use will also carry over. so you're not just sharing storage, you're getting the texcoords too. slay. πŸ”₯


✨ NOTES ✨

  1. if you try to set the image to a value larger than the number of available slots, it gets ignored and you get a warning. no cap, bestie β€” check your indices. πŸ’€

✨ EXAMPLE ✨

here's the whole thing, copy it exactly character for character, i'm serious 🫢

function set_image_as_frame0()
      a = fill_surface(32, 32, 255, 0, 0);
      image_framesetsize(a, 3);
      b = fill_surface(32, 32, 0, 255, 0);
      c = fill_surface(32, 32, 0, 0, 255);
      set_image_as_frame(a, b, 1);
      set_image_as_frame(a, c, 2);
      image_framecyclemode(1, 1);
      show_image(a);
end

look at her go 😭 a is a red surface with 3 slots, b is green and lands in slot 1, c is blue and lands in slot 2, then image_framecyclemode(1, 1) kicks off the cycling and show_image(a) makes it visible. the way this is literally a whole animation in nine lines. obsessed. 🧚


✨ SEE ALSO ✨

go read these next, they're all part of the same friend group πŸ’œ


fr fr, double-check your index before you call this. the warning is real and it will humble you. 🌈

kisses bestie, that's the page πŸ’– this was the image source, October 2026 edition, and you've been reading set_image_as_frame(3) β€” now go make something move βœ¨πŸŽ€

πŸ“¦ where this page comes from