Advertisement
Guest User

Untitled

a guest
Sep 16th, 2022
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | Source Code | 0 0
  1. ----------------------------------------------------------------------
  2. -- Skew selection to isometry
  3. -- based on https://github.com/aseprite/Aseprite-Script-Examples
  4. ----------------------------------------------------------------------
  5.  
  6. if app.apiVersion < 1 then
  7.   return app.alert("This script requires Aseprite v1.2.10-beta3")
  8. end
  9.  
  10. local cel = app.activeCel
  11. if not cel then
  12.   return app.alert("There is no active image")
  13. end
  14.  
  15. -- The best way to modify a cel image is to clone it (the new cloned
  16. -- image will be an independent image, without undo information).
  17. -- Then we can change the cel image generating only one undoable
  18. -- action.
  19. local img = cel.image:clone()
  20.  
  21. local step = 2
  22.  
  23. local sel = app.activeLayer.sprite.selection.bounds
  24.  
  25. for i = sel.width-1, 0, -1 do
  26.   for j = sel.height-1, 0, -1 do
  27.     local px = img:getPixel(sel.x + i, sel.y + j - (i/step))
  28.     img:drawPixel(sel.x+i, sel.y+j, px)
  29.   end
  30. end
  31.  
  32. -- Here we change the cel image, this generates one undoable action
  33. cel.image = img
  34.  
  35. -- Here we redraw the screen to show the modified pixels, in a future
  36. -- this shouldn't be necessary, but just in case...
  37. app.refresh()
  38.  
Tags: aseprite
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement