image_origo_offset(3)

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

πŸ’… image_origo_offset(3) β€” the Arcan Lua API one

Okay so bestie, welcome to image_origo_offset, from the Arcan Lua API, section 3 of the manual. This is the little function that lets you nudge where an object thinks its center of rotation is, and where it anchors itself. It's giving "I'm the main character and my pivot point is wherever I say it is" energy. ✨


🌸 NAME 🌸

image_origo_offset β€” shift the current object rotation and anchoring offset πŸ’«


πŸŽ€ SYNOPSIS πŸŽ€

nil
image_origo_offset( vid:dst, number:xofs, number:yofs )
image_origo_offset( vid:dst, number:xofs, number:yofs, number:zofs=0.0 )
image_origo_offset( vid:dst, number:xofs, number:yofs, number:zofs=0.0 )
image_origo_offset( vid:dst, number:xofs, number:yofs, number:zofs=0.0,
int:anchor )

Yeah, it returns nil. No takebacks, no value, just vibes and a shifted origo. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

So like, by default every object's rotation origo is set to its local center β€” that's (0.5*w, 0.5*h), literally the middle of the thing. This function is your little handle for adding an offset value on top of that. That's it, that's the whole bit. πŸ’–

Now for anchoring, the valid anchor values are, and I quote the whole squad:

  • ANCHOR_UL : upper-left
  • ANCHOR_CR : upper-center
  • ANCHOR_UR : upper-right
  • ANCHOR_CL : center-left
  • ANCHOR_C : center
  • ANCHOR_CR : center-right
  • ANCHOR_LL : lower-left
  • ANCHOR_LC : lower-center
  • ANCHOR_LR : lower-right
Yeah bestie, ANCHOR_CR shows up twice in that list (upper-center and center-right). That's literally what the page says, so I'm not out here editing the source material. πŸ™ˆ Note it and move on.

⭐ NOTES ⭐

  1. Rotation offset is relative to the local object itself. For complex object hierarchies, the bounding volume would have to be calculated and each object shifted in turn. No cap, that's just how it is β€” you don't get free nested shifting, you gotta do the math per object. 😭

πŸ”₯ EXAMPLE πŸ”₯

function image_origo_offset0()
      a = fill_surface(32, 32, 255, 0, 0);
      b = fill_surface(32, 32, 0, 255, 0);
      show_image({a, b});
      move_image(a, 50, 100);
      move_image(b, 100, 100);
      rotate_image(a, 45);
      rotate_image(b, 45);
      image_origo_offset(b, -10, -10);
end

Two squares, both spun 45Β°, but only b gets its origo yanked by -10, -10. Watch them rotate around completely different points. Iconic. πŸ‘‘


🌈 EXAMPLE 🌈

function image_origo_offset1()
            a = fill_surface(128, 128, 255, 0, 0)
      b = fill_surface(32, 32, 0, 255, 0);
      show_image({a, b})
      link_image(a, b, ANCHOR_LR)
      image_origo_offset(a, 0, 0, 0, ANCHOR_C)
end

Here we link a to b at ANCHOR_LR, then set a's anchor to ANCHOR_C β€” zero offset on all axes, just a straight anchor switch. Slay. πŸ’…


πŸ’œ SEE YA πŸ’œ

That's the whole page, bestie β€” originally from image, dated October 2026, living at image_origo_offset(3). Go forth and pivot correctly. πŸ§šβ€β™€οΈπŸ’–

πŸ“¦ where this page comes from