Create gif to illustrate algorithms with Microsoft PowerPoint

Animate the algorithm development with gif pictures made with Microsoft PowerPoint!

This morning, I was trying to solve a dynamic programming problem and visualize the process with a table. It suddenly came to me that I can animate the process with a gif. My first thought was to use Adobe AI, then after I opened the application, I ran into the first problem: draw a table! Obviously I am not expert of Adobe Illustrator, I don’t even draw or paint decently! The next thing that came into my mind is PowerPoint. Right, the ultimate solution for all animations.

I have seen people recreate Apple ads videos Designed by apple in california original video on YouTube and then the 108 second one with powerpoints, and it was stunning. Since then I knew how powerful PowerPoint can be, and I actually created a campaign video for my friend in their L’Oreal Campus Challenge with PowerPoint. But it takes time. What I am about to do next is way simpler, my purpose of writing the post is simply to show a possibility. If you have a easier or faster way, please comment and tell me about it! I’d love to learn more.

A few questions up front

  1. How do I get .gif from .pptx?

    Two ways, both are straightforward and free! (You need subscription for Microsoft Office 365 though)

    a. Export the slides as a video file (.mp4 or .mov), then convert it to a gif.

    b. Export the slides as individual pictures, each frame corresponding to one image, and then concatenate them into a gif file.

  2. Why would I choose PowerPoint over AI?

    First, if you don’t have or are not familiar with AI and other design apps. PowerPoint would save you from the learning curve. (I assume everyone has made slides before.)

    Second, it is actually easier to draw diagrams and tables as needed in an algorithm visualization because that’s what powerpoint is designed for.

    Third, the derivation of answers is discreet, so ppt animations are great for the purpose. (In the latest version fo PowerPoint, the animation will help animate the transitions too.)

  3. What do I need to know about powerpoint?

    Only the Basics. No extra package needed. Insert a special symbol. Change the color and size of a box. Add an animation. That’s it.

    Trust me, I have been playing with PowerPoint animations since 4-th grade, remember the built-in clip art? Those are my childhood memories. The only thing you need is a bit of patience.

Getting Started

So the example I used is a dynamic progrmming problem, where a ski Resort tries to assign the most close size of skis to skiers. The program measures disparity by summing up the absolute value of differences between the heights of customer and the size of ski boards. The goal is to minimize the disparity. (In this problem the resort always has enough number of boards for all customers m>=n). I will not go into the details here.

What I want to create is a 6x7 table, with animation showing how the table is filled out step by step. I will use arrows to show how one answer leads to another in the recursion steps. On the side, The corresponding pseudo-code will show as the arrows and numbers appear.

I took it straight from my homework, so credit to my algorithm course instructor Eric. Hopefully no one from my class will see my solution before the deadline of the assignment.

Here I want to make a classic dynamic programming table with a test case:

Skier Height = [63, 65, 67, 69, 71]
SKi Height = [60, 64, 66, 68, 70, 80]

Make Grid

I start by drawing out the boxes and legend with Table, Shape, and Text Box. Then I grouped the shapes, for easier management.


If you have OCD, you might notice that the numbers are not perfectly aligned. I don’t need to, it takes too long to manually align them. I only need to align them with the Arrange toolbox after I am done.


Object Arrangement

In fact, I don’t even need to put each number above the correct column. Arrangement is going to handle them all.

In the following example, I want to add a letter B to the top-right corner of the cell in the first row to indicate they are the basecase cells.

What I did was:

  1. Create a text box B, ⌘-c ⌘-v it 6 times.
  2. Put the first and the last one it the right place.
  3. Arrange - Align - Distribute Horizontally
  4. Arrange - Align - Align Top




Then I repeat the similar stuff for cells in diagonal line. This is the other set of base cases.


Select Pane - Object Management

By now, I have finished my first steps of my algorithm. I want to create some animations. I want the first test cases to show simutaneously, so I grouped them. To see what objects I have so far, I opened the Selection Pane from the Format tab.


The boxes were a product of copy and paste, so they have pretty bad names. This will make the Animation Pane a mess and impossible to work with (when you have more animations and objects on the canvas). So I renamed them.


Now the Animation Pane is a pleasure to the eye. (Same thing for writing readable codes, right?)


Operating on layers

If you are a Photoshop user, you must be familar with the concept of layers. With layers, you can work on part of the images and not mess up other parts. With Selection Pane, you can do the same thing.

My next step is to add small arrows to connect cells, I just need to dupliate 6 small arrows and do the same object arrangement tricks again. So I made 6 arrows, put the first one and last one in place. But here comes a new problem. With all these numbers and subscripts each being independent text boxes, it can be really hard for me to select only the arrows.

I open the selection pane, click hide all, and make only the 6 arrows visible. Select All, Arrange, Distribute, Done! Effortless.


With these arrows selected, I click on Animation to give every element I selected with the same Fade effect.


Before you un-select, remember to change the timing option to be on-click or after previous. The default behavior is to appear together when you create animation for multiple objects.


Let’s see how that goes! (I realized I didn’t need to fill all the zeros so I deleted them.)


Divide and Conquer

Now that I have finished all the base cases. I need to move on to the recursive steps. The Animation Pane is filled with many boxes.

It seems like a good time to commit the work and build new features in a new branch. Why don’t wee save the work here and start the next stage somewhere else? The good thing about copying and pasting in PowerPoint is that, the animations is also copied. So I only need to work on additional features in a new slide, and copy it back after I have finished testing it.

I duplicate the the canvas, remove the animations from previous page, and start working on new features.

Two more steps: 1. add the arrow for recursive calls; 2. calculate the disparity in the return expression. Two more canvas.




I can now work on different features in different pages. Even when I need to modify the features in previous pages, I do not need to copy the change into later slides. Sounds pretty git, huh.

When I was editing the new pages, I went back and changed the arrow colors, added some more words. When I copy the new arrows back later, all I need to do is to select the new feature in the Selection Pane, and put them in the right places.

Most likely, the animations will be appended to the end of the animations flow.



Then I just changed the duration of each animation to make sure it is not too fast.


See the work!

Use the Export - As video to get the .mp4 file. Then google convert mp4 to gif, you’ll see a whole page of free online tools.

Now it’s time to show off your work!