2 Star 0 Fork 0

mirrors_aseprite/Aseprite-Script-Examples

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Glass Floor.lua 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
David Capello 提交于 2019-06-29 10:19 +08:00 . Add Glass Floor example
----------------------------------------------------------------------
-- Creates a new layer that looks like a glass floor flattening the
-- selected layers in the timeline.
----------------------------------------------------------------------
do
local spr = app.activeSprite
if not spr then return app.alert "There is no active sprite" end
app.transaction(
function()
local bounds = Rectangle()
local layers = app.range.layers
local newLayer = spr:newLayer()
newLayer.name = "Glass Floor"
newLayer.opacity = 128
for _,frame in ipairs(spr.frames) do
for _,layer in ipairs(layers) do
local img = Image(spr.spec)
for _,l in ipairs(layers) do
local layerCel = l:cel(frame)
if layerCel then
img:drawImage(layerCel.image, layerCel.position)
bounds = bounds:union(layerCel.bounds)
end
end
spr:newCel(newLayer, frame, img, Point(0, 0))
end
end
local oldFrame = app.activeFrame
app.activeLayer = newLayer
for _,cel in ipairs(newLayer.cels) do
app.activeFrame = cel.frame
app.command.Flip{ target="mask", orientation="vertical" }
cel.position = Point(cel.position.x,
cel.position.y + 2*(bounds.y + bounds.height - spr.height/2))
end
app.activeFrame = oldFrame
end)
end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_aseprite/Aseprite-Script-Examples.git
git@gitee.com:mirrors_aseprite/Aseprite-Script-Examples.git
mirrors_aseprite
Aseprite-Script-Examples
Aseprite-Script-Examples
main

搜索帮助