How to create an animated NFT Collection in GIF?


If you are familiar with NFTs, you may notice that many NFT collections are…still images. Yes, there are still few animated NFT collections like the ones from the Random Character Collective (SlimHood, MoodRoller, Invisible Friend) but why aren’t there more animated collections? Because there’s no free-ready-to-go-tool at the moment to make animated generative art. Most NFT creators use the HashLips Art Engine, which you may know. Yes, it’s free, but you can only create static images.

What I wanted was to create animated Gif. I tried some alternatives and paid solutions, but I wasn’t satisfied.

I had to build it myself.

Why Gif?

A Gif is easy to share, loopable and it’s cool!

When I have something in mind, I tend to be obsessed with it. Since then, my objective has been to find a workflow to create generative gifs where I can prepare some pre-animated assets. Then a magic-script-that-does-not-exist-yet will turn everything into a collection of thousands of designs! 🦄

What is generative gif? If I want to create a collection of thousands of Gifs, I don’t need to create them manually. The concept of generative art is to deconstruct your image into assets and create many assets variations. Then a script will make a random combination of these assets based on your conditions.

Initial thought

When I first started the designs of AnimAlls I drew and animated all these assets using Procreate on iPad, doing all the drawings and some frame-by-frame animations. I already had a script on After Effects to create Gifs but I didn’t find a solution to make it generative. I was focusing on making the drawings only.

I was wrong.

Aha moment #1

The big aha moment arrived when I almost finished my designs and started looking for a solution to make them generative. I found this awesome script for After Effects: CompsFromSpreadsheet 5.

CompsFromSpreadsheet allows you to quickly generate copies of your After Effects compositions, updating the new comps with data from a spreadsheet to insert text and replace layers.

It means that I “just” need to create a spreadsheet with all the layers indicated in it, and this script will be able to create all the compositions inside After Effects with all the variations… ready to export! 🤯

But what will I do with all these compositions? How will I export it in Gif?

Aha moment #2

Luckily there’s another plugin that makes the export to Gif easy GifGun!
It can do batch export! PERFECT! 🤯

The only question left is, how do I generate the spreadsheet with thousands of lines with all the data?

Oh! I have some skills in Python to do that! 😅

So it seems that I have my workflow there: use Python to create a spreadsheet that specifies which asset to use, including the rarities and conditions, then use CompsFromSpreadsheet to import it into After Effects as comps. And finally, use GifGun to export the comps in bulk. Voilà!

Workflow for Generative Gif with Python & After Effects

Why am I excited?

After Effects is well-known for making visual effects and motion graphics videos. With this workflow, I can use the power of After Effects inside the design, natively integrate visual effects and export it straight to a GIF. Everything would be generative! 🤩

Python ❤

I am a self-taught programmer in Python so if experts are reading these lines, excuse my language! 🤓

The good thing about starting from scratch is you can control everything. From the algorithm to the metadata. For this, I am relying on Python to:
- Manage the rarity traits
- Generate the CSV Files for After Effect
- Generate the Metadata in JSON Format

I am using these libraries:

import random        # Shuffle and make random choices
import os # Fetch assets from disk to create databases
import pandas as pd # Play with datas
import csv # Create CSV for After Effects
import openpyxl # Create a XLS file (optional)
import json # Create the NFT metadata
from datetime import datetime # Date in the metadata (optional)

Rarity Cards vs Rarity Traits

I used to play a lot at Fifa Ultimate Team (Yes!). For those who don’t know, you receive some “pack rewards” every week with new players to improve your team. I remember most is the hope/excitement to receive a rare player card with higher stats! How do you recognize a rare player card? An obvious different design!

I wanted to reimplement this concept in the collection — The idea of Rarity Cards instead of Rarity Traits. A Rare Card will have more rare traits than a Common Card. Thus I created three types of cards : Common / Rare / Ultra Rare + the unique cards.

I thought about this approach in Python:
1. Generate a list of Type of Cards
2. Assemble the assets for each card in the list (Background > Body…)
3. For each asset, first check the Type of Card, then choose the Type of Assets to assemble the design.

Type of Cards

First, in Python, I generate a list of Type of Cards (Common, Rare, Ultra) and will shuffle it to make a collection_base. Here is an example for a 10 NFTs collection (not the real repartition):

['Rare', 'Common', 'Common', 'Common', 'Common', 'Rare', 'Common', 'Ultra', 'Common','Common']

There are 7 Commons, 2 Rares, 1 Ultra in random order. Thanks to a loop function, the script will assemble the design for each card in this list (Background, Body, Color…)

Type of Assets

Based on the card’s type, I will use another function to choose the Type of Asset. I also have three kind of assets (Common / Rare / Ultra).

With an If/Else statement, the script will choose the Type of Assets with predetermined criteria:

  • If Common Card Then: 3/4 chance to choose a common asset and 1/4 chance to select a rare asset.
  • If Rare Card Then: 2/4 chance to choose a common asset and 1/4 chance to select a rare asset, 1/4 chance to select an ultra-rare asset.
  • If Ultra Rare Card Then: 1/2 chance to choose a rare asset and 1/2 chance to select an ultra-rare asset.
def chose_cards(card):
#for card in collection_base:
global x
global cx
if card == "Common":
cx = random.choice(["common", "common", "common", "rare"])
if cx == "common":
x = random.choice(asset_common)
x = random.choice(asset_rare)
elif card == "Rare":
cx = random.choice(["common", "common", "rare", "ultra"])
if cx == "common":
x = random.choice(asset_common)
elif cx == "rare":
x = random.choice(asset_ultra)
x = random.choice(asset_rare)
cx = random.choice(["rare", "ultra"])
if cx == "rare":
x = random.choice(asset_ultra)
x = random.choice(asset_rare)

Of course, my asset files split by into types on my hard drive. I have three folders inside for each layer (e.g Background): Common / Rare / Ultra. Once the script knows the type of asset, it will choose a random asset in the correct folder.

At the end of the process, with the Pandas library I will have a database of cards with the list of assets to assemble the design. Then with the csv library I can convert and export everything in a CSV file for After Effects!

After Effect & Final GIF

Before using CompsFromSpreadsheet, I need to set up my composition. A composition in After Effect is your framework with its own timeline where you have all your layers. Because I can export directly from After Effects, I can integrate some effects into composition.

The objective is to create a composition with built-in effects and integrate indications on each layers, provided by CompsFromSpreadSheet, on where to sync what.


Slowly I could adapt my work to integrate After Effects in the creation of the design. The good thing with After Effects is you can add a little bit of programming called expressions.

An expression is small piece of JavaScript code that you can plug into animated properties in your After Effects projects […] An expression tells a property to do something.

In other words, it helps create more complex animation or speed up your workflow. In my case I can link certain parameters together like the light source angle with a Text Layer:

  • In the CSV, I can add a column “angle”. For each NFT, the script will generate a random number between -45 and 180.
  • CompsFromSpreadsheet can fetch the “angle” column and update a dedicated Text Layer in the composition.
  • My light source in the composition called Sun links to this Text Layer. If the Text is 90, the Sun will be at 90° in the composition.
Dynamic light linked with a Text Layer

With this technique I can add some uniqueness to each AnimAlls.
Thanks to After Effects I can also add a wiggle effect to the composition:

Left: Wiggle off — Right: Wiggle on

The final step is to follow the instructions provided by CompsFromSpreadsheet to indicate which layer will receive data and its type. For this I need to rename a bit the layers:

  • Starting with ^ will replace the text with another text (like the Sun Angle)
  • Starting with > will replace the layer with a file (image or video)

All my assets already have: the same size and on transparent background both for images and videos.

Layers in After Effects

And we are not limited to one composition! I can set up different compositions with different effects. I can specify on the CSV which composition to use and CompsFromSreadsheet will load the correct one !

For example, I have another “Aquarium” composition with additional effects and bubbles. Back to Python I can setup a condition:

  • If Top layer is “Aquarium” Then: use AnimAlls Aquarium Composition
Aquarium Composition

Once the CSV is ready and all my compositions set up, I can run CompsFromSreadsheet to generate the individual compositions with the correct assets loaded! At the end I am left with:

Selecting the Comps > Click on GifGun > Render. Done!

Key Take Away

With this out-of-the-box method you can:

  • Use Python to generate a CSV with all the traits
  • Use CompsFromSpreadsheet to generate compositions in After Effects from your spreadsheet
  • Use GifGun to batch render in Gif!
  • Additionally you can generate advanced Metadata (not covered in this article) still with Python

CompsFromSpreadsheet will only read the spreadsheet. Therefore for managing the layer’s traits and organization, you must rely on something else. I am more familiar with Python, but any language will do. You are fine as long as you can produce a spreadsheet with balanced traits and data!

What’s Next?

What excites me most is the ability to use the power of After Effects to create animations and visual effects. I know that I didn’t exploit its true power yet.

As I am finishing AnimAlls I plan to work on another collection with vector designs that are way better to animate (I love them!). The next collection will be open to early adopters of AnimAlls. Stay tuned!

Where to find me?

NirinA Twitter:

NirinA Instagram:

AnimAlls Discord:

AnimAlls Official website:

AnimAlls Twitter:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store