Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------------------
- -- Skew selection to isometry
- -- based on https://github.com/aseprite/Aseprite-Script-Examples
- ----------------------------------------------------------------------
- if app.apiVersion < 1 then
- return app.alert("This script requires Aseprite v1.2.10-beta3")
- end
- local cel = app.activeCel
- if not cel then
- return app.alert("There is no active image")
- end
- -- The best way to modify a cel image is to clone it (the new cloned
- -- image will be an independent image, without undo information).
- -- Then we can change the cel image generating only one undoable
- -- action.
- local img = cel.image:clone()
- local step = 2
- local sel = app.activeLayer.sprite.selection.bounds
- for i = sel.width-1, 0, -1 do
- for j = sel.height-1, 0, -1 do
- local px = img:getPixel(sel.x + i, sel.y + j - (i/step))
- img:drawPixel(sel.x+i, sel.y+j, px)
- end
- end
- -- Here we change the cel image, this generates one undoable action
- cel.image = img
- -- Here we redraw the screen to show the modified pixels, in a future
- -- this shouldn't be necessary, but just in case...
- app.refresh()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement