Skip to content

Instantly share code, notes, and snippets.

@bullno1
Created September 26, 2025 07:11
Show Gist options
  • Select an option

  • Save bullno1/cc6fca1ff34704ef14ca9da8014c1378 to your computer and use it in GitHub Desktop.

Select an option

Save bullno1/cc6fca1ff34704ef14ca9da8014c1378 to your computer and use it in GitHub Desktop.
Set pivot script for aseprite
if app.apiVersion < 21 then
return app.alert("This script requires Aseprite v1.3-rc1")
end
-- This script requires UI
if not app.isUIAvailable then
return
end
local sprite = app.cel.frame.sprite
local function find_origin()
for i, slice in ipairs(sprite.slices) do
if slice.name == 'origin' then
return slice
end
end
end
local origin = find_origin()
if origin == nil then
origin = sprite:newSlice(0, 0, sprite.width, sprite.height)
origin.name = 'origin'
end
app.editor:askPoint{
title="Set pivot",
point=origin.pivot,
onclick=function (ev)
origin.pivot = ev.point
end,
decorate = {
rulers=true,
dimmed=true,
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment