Lottie Tools for Affinity
dailyRushes Scripts for Affinity
Animate animates your artwork inside Affinity: record the changes you make on the canvas as clips, adjust and play them, then save a Lottie animation.
The other tabs here cover Import and export with the Lottie script, Batch Export with Batch Lottie, and Saving Files for all three.
The Lottie script brings Lottie files into Affinity as editable shapes, and turns your artwork into still Lottie files. It has two tabs at the top: Import and Export.
Import: Lottie file
File
Every .json file in your allowed folders, labelled with its folder. Choose one and it is read straight away. The list starts on the file you imported last.
Choose file...
Opens File Explorer to pick a .json file, for example one in a folder inside an allowed folder, or one saved after the window opened.
File details
The line under the buttons shows the chosen file’s size, frame rate, length and number of layers.
Import: Or paste a Lottie
Paste the text of a Lottie file into the box. While there is text in the box, it is used instead of the file. Choosing a file clears the box.
Import: Import
Frame
The moment of the animation to bring in. 0 is the start.
Position
Where the artwork goes:
- Top-left of the page: the artwork’s own top-left corner goes to the page’s top-left corner.
- Centre of the page: the artwork is centred on the page.
- Same place as in the file: keeps the spot it had in the Lottie.
Select one artboard before running the Lottie script to place the artwork on that artboard instead. The artwork always comes in at the file’s own size.
Import: What will come in
Lists the shapes, groups and layers that will be created, and anything that will be left out or changed. It updates whenever you change a setting.
- Check the list.
- Click OK to import, or Cancel to stop without importing.
Everything comes in as one group, named after the Lottie, and is selected afterwards. To remove it in one go, use Edit > History and click the step before the import.
| Comes in | Left out |
|---|---|
| Shape layers, groups and their names, paths, rectangles, ellipses, stars and polygons | Text layers, images |
| Solid and gradient fills, strokes, dashes | Masks and track mattes |
| Position, rotation, scale, opacity, parenting, precomps | Effects, trim paths, repeaters, expressions |
Export
Turns your artwork into a still Lottie file. To export animation, use Animate.
Export
- Selection (or artboard): the selected objects, or one selected artboard. The Lottie is cropped to fit them.
- Whole page: everything on the page.
Scale %
Makes the Lottie bigger or smaller than the artwork.
Make Lottie
Builds the Lottie and shows it below.
Lottie JSON
The Lottie file as text. Click in the box, press Ctrl+A then Ctrl+C to copy it. The box below lists what was exported and anything that could not be converted.
File name
The name for the saved file. It is filled in for you after Make Lottie.
Folder
Where to save: your allowed folders.
Save to folder
Makes the Lottie again and saves it as a .json file.
On the Export tab, OK and Cancel just close the window. Nothing is imported.
Batch Lottie saves each object as its own still Lottie file, named after its layer, in one go.
What to export
Export
- Each selected object: one file for each object you selected.
- Each object inside the selected group: select one group, and each object inside it becomes a file.
Hidden objects are always left out. A background shape inside the group is exported too, so select just the objects you want if you don’t want it.
Name prefix
Optional: added to the start of every file name. For example, lower- gives lower-01.json.
Size
- Cropped to each object: each file is just the object.
- Full page (keeps its place): every file is page-sized, with the object where it is on the page.
Scale %
Makes every file bigger or smaller than the artwork.
Where
Folder
Your allowed folders and the folders inside them.
Choose a file in the folder...
For a folder further in: pick any file in it, and the Lottie files are saved next to it.
Saving to
Shows the folder the files will be saved in.
If a file exists
- Replace it: the old file is overwritten.
- Skip it: the old file is kept and that object is not saved.
- Keep both (add a number): the new file gets a number, such as
01 2.json.
Files
File list
Every file that will be written, shown before anything is saved, for example 01 → 01.json. Files that will replace or skip an existing file are marked.
File names come from the layer names. Accented letters and characters Windows doesn’t allow are changed, and two objects with the same name get a number.
Export
Writes all the files in the list.
Report
Each file saved, with its size, and anything that could not be converted, such as text or pictures.
OK and Cancel just close the window. Files are only saved when you click Export.
Affinity only lets scripts open and save files in folders you have allowed. Without this, the Animate, Lottie and Batch Lottie scripts can’t save Lottie files, and the Lottie script can’t find Lottie files to import.
Allow scripts to use a folder
- In Affinity, choose Edit > Settings. On a Mac, choose Affinity > Settings.
- Click Scripting.
- Turn on Access the file system.
- Under File system access, click Add.
- Choose the folder for your Lottie files, then confirm.
The folder appears in the File system access list. The scripts can now use it straight away, and they list it in their Folder and File dropdowns the next time you open them.
Folders inside an allowed folder
Allowing a folder also allows every folder inside it. For example, if your Desktop is allowed, Desktop\lotties can be used too, without adding it separately.
Stop scripts using a folder
- Choose Edit > Settings > Scripting.
- Under File system access, click the folder in the list.
- Click Remove.
The folder and its files are not changed or deleted. Scripts just can’t open or save there any more.
To stop scripts using any folders at all, turn off Access the file system.
Which folder to allow
- Allow only what you need. A folder you keep for Lottie files, such as
Desktop\lotties, is safer than a whole drive. - The Desktop is a handy choice. Any folder you make on it can be used straight away.
- Several folders can be in the list. The scripts show all of them.
If saving doesn’t work
| What you see | Fix |
|---|---|
“Affinity is not letting scripts save” or “read”, with PERMISSION_DENIED or NOT_ALLOWED |
Turn on Access the file system, and add the folder (or a folder it is inside) under File system access. |
| “No allowed folders”, or the Folder list is empty | No folder has been added yet. Add one as shown above, then close and reopen the script. |
| A folder you just added isn’t in the list | The lists are made when the script’s window opens. Close it and run the script again. |
| A new Lottie file isn’t in the Lottie script’s File list | It was saved after the window opened, or it is in a folder inside an allowed folder. Use Choose file..., or run the Lottie script again. |