set_image_as_frame(3)
π 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 β¨
- 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
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms