Skip to content

Instantly share code, notes, and snippets.

View dacap's full-sized avatar
🎨
Programming

David Capello dacap

🎨
Programming
View GitHub Profile
@dacap
dacap / Plasma.lua
Created July 4, 2019 00:17
Plasma Script for Aseprite -- https://www.aseprite.org
-- Copyright (C) 2019 David Capello
local dlg = Dialog("Plasma")
:number{ id="width", label="Size:", text="100", focus=true }
:number{ id="height", text="100" }
:number{ id="frames", label="Frames:", text="100" }
:button{ id="ok", text="OK", focus=true }
:button{ id="cancel", text="Cancel" }
dlg:show()
@dacap
dacap / Move Layer Down.lua
Last active February 10, 2025 21:59
Move active layer up/down in Aseprite
local layer = app.activeLayer
if layer then
layer.stackIndex = layer.stackIndex-1
end
@dacap
dacap / Switch Non-Active Layer Opacity.lua
Created July 3, 2023 22:50
Switch Non-Active Layer Opacity
if app.preferences.experimental.nonactive_layers_opacity == 255 then
app.preferences.experimental.nonactive_layers_opacity = 128
else
app.preferences.experimental.nonactive_layers_opacity = 255
end
@dacap
dacap / Export Tileset.lua
Last active December 7, 2024 17:56
Export tileset
if TilesetMode == nil then return app.alert "Use Aseprite v1.3" end
local lay = app.activeLayer
if not lay.isTilemap then return app.alert "No active tilemap layer" end
local tileset = lay.tileset
local dlg = Dialog("Export Tileset")
dlg:file{ id="file", label="Export to File:", save=true, focus=true,
filename=app.fs.joinPath(app.fs.filePath(lay.sprite.filename),
math.randomseed(os.time())
chars = { ".", "O" }
for i=1,20 do
s = ""
for j=1,80 do
s = s .. chars[math.random(1, 2)]
end
print(s)
end
@dacap
dacap / cara-o-cruz.lua
Created May 26, 2023 23:54
Cara o cruz
if math.random(1, 2) == 1 then
print "Cara"
else
print "Cruz"
end
@dacap
dacap / Set Pixel Ratio and Center.lua
Created August 30, 2024 18:12
Shows a dialog to sets the pixel ratio of the active sprite and center the editor scroll
local dlg
dlg = Dialog("Pixel Ratio")
:entry{ id="w", label="Width", text="1" }
:entry{ id="h", label="height", text="1" }
:button{ id="test", text="Test", onclick=function()
app.sprite.pixelRatio = Size(dlg.data.w, dlg.data.h)
app.command.Zoom{ action="in" }
app.command.Zoom{ action="out" }
app.command.ScrollCenter()
end }
@dacap
dacap / AlwaysOnTop.ahk
Created December 13, 2011 02:10
AutoHotKey script for "Google Chrome - Always on top"
#o::
WinSet, Alwaysontop, , A
WinGet, ExStyle, ExStyle, A
if (ExStyle & 0x8) ; 0x8 is WS_EX_TOPMOST
{
WinSet, Transparent, 204, A
}
else
{
@dacap
dacap / Convert to Tilemap Quickly.lua
Created April 18, 2024 12:31
Convert current layer to a tilemap on Aseprite without showing the dialog
app.command.ConvertLayer{ ui=false, to="tilemap" }
@dacap
dacap / Open as RGB.lua
Created December 12, 2023 00:57
Open as RGB
local oldSprite = app.sprite
app.command.OpenFile()
if oldSprite ~= app.sprite then
app.command.ChangePixelFormat{ format="rgb" }
end