|
| 1 | +# Slices |
| 2 | + |
| 3 | +With the Slice tool  you can |
| 4 | +indicate regions of your sprite and assign a name/label to that region |
| 5 | +with some extra user defined information. There is support to specify |
| 6 | +[9-slices](https://en.wikipedia.org/wiki/9-slice_scaling)/9-patches |
| 7 | +information. |
| 8 | + |
| 9 | +With this tool you can: |
| 10 | + |
| 11 | +1. Create a new slice marking a rectangular region pressing the mouse |
| 12 | + button, dragging the mouse, and releasing the button. |
| 13 | +1. If the marked rectangle touches existing slices, those slices will |
| 14 | + be selected. |
| 15 | +1. You can drag-and-drop a set of selected slices to move them to |
| 16 | + other place. Or you can resize the whole set of slices dragging |
| 17 | + from the corners or edges. |
| 18 | +1. After selecting some slices you can delete them pressing the Delete |
| 19 | + key or *Edit > Delete* menu option. |
| 20 | +1. Double-clicking a slice you will see the [Slice |
| 21 | + Properties](#slice-properties) dialog. |
| 22 | + |
| 23 | +## Slice Properties |
| 24 | + |
| 25 | +If you double-click a slice, you will see its properties: |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +Here you can specify: |
| 30 | + |
| 31 | +1. the bounds of the slice in the canvas |
| 32 | +1. a 9-slices property to specify an internal rectangle to sub-divide the bounds into sub-slices |
| 33 | +1. a pivot to specify the central/base location of the sprite inside the slice |
| 34 | + |
| 35 | +## Exporting Slices |
| 36 | + |
| 37 | +You can export each slice as a different sprite using the |
| 38 | +[--split-slice option](cli.md/#split-slices). |
| 39 | + |
| 40 | +You can also export the slice information in a sprite sheet JSON using |
| 41 | +the [--data option](cli.md/#data)) or the *File > Export Sprite Sheet* |
| 42 | +menu option with the JSON output checked. This is an example of the exported data: |
| 43 | + |
| 44 | +```json |
| 45 | +{ ... |
| 46 | + "meta": { |
| 47 | + ... |
| 48 | + "slices": [ |
| 49 | + { "name": "Button-patch", |
| 50 | + "color": "#0000ffff", |
| 51 | + "keys": [{ "frame": 0, |
| 52 | + "bounds": {"x": 118, "y": 118, "w": 20, "h": 21 }, |
| 53 | + "center": {"x": 5, "y": 5, "w": 10, "h": 9 } }] } |
| 54 | + ] |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +**SEE ALSO** |
| 61 | + |
| 62 | +[Drawing](drawing.md) |
0 commit comments