• Portfolio
    • Documentary
    • Commercial
    • Explainer
  • Projects
    • And Their Craft
  • Blog
  • About
  • Contact
  • Menu

Joe Collins

  • Portfolio
    • Documentary
    • Commercial
    • Explainer
  • Projects
    • And Their Craft
  • Blog
  • About
  • Contact
bingo-example.gif

Bingo Card Generator

September 17, 2019 in Animation, After Effects

Some Background

At a previous job, I was tasked with making BINGO cards. There were 50 cards in total: 25 unique background designs with 50 different numbered setups. This means designs were duplicated.

I designed the original cards in Adobe Illustrator. I didn’t have the time to learn how to use InDesign which, based on my limited research, would have made this a million times easier.

Fast forward a few years and I want to make more cards. I again looked into using the Data Merge function in InDesign. A csv or txt file is needed for Data Merge, so my first attempt in creating the card was in Google Sheets.

Futzing around with spreadsheets

Futzing around with spreadsheets

This ended up not working out because I couldn’t get the numbers working right in Sheets and I didn’t feel it wasn’t going to be as efficient as I wanted it in InDesign.

There was also a short lived attempt at making some type of web app, but that didn’t pan out either. 

Eventually I joked, “I could do this in After Effects.” So I did.

AEbingo.png

BINGO CARD EXPRESSIONS

The  expressions I use are formatted for the new Javascript engine in the newer versions After Effects, so make sure you have that selected in project settings.

[Project Settings > Expressions > Javascript]

Each column is a single text layer, driven by an expression to shuffle the array for that given column. I had to search around for the right mix of functions to make this work and modify it a bit to work in AE.

The expression uses the Fisher-Yates Shuffle algorithm to shuffle the array (created by a fancy javascript array creation method I don’t fully understand). This shuffles every frame, but could be changed within the expression or via time remapping.

Here’s the expression I used for the Source Text in the B layer.

function shuffle(array) {
  var currentIndex = array.length, temporaryValue, randomIndex;
  
    // While there remain elements to shuffle...
    while (0 !== currentIndex) {
    
        // Pick a remaining element...
        randomIndex = Math.floor(Math.random() * currentIndex);
        currentIndex -= 1;

        // And swap it with the current element.
        temporaryValue = array[currentIndex];
        array[currentIndex] = array[randomIndex];
        array[randomIndex] = temporaryValue;
  }
  return array;
}

const range = (start, end) => {
    const length = end - start;
    return Array.from({ length }, (_, i) => start + i);
    }

var arr = range(1,16); // Determine the range of the array
shuffle(arr); // Shuffle the newly created array
arr.join("\n") // Separates the array with a line break

Simply duplicate the layer 4 times and change  arr = range(1,16); to match the correct values for each column. That’s pretty much it as the rest is just design. 

DESIGN

Here’s a quick overview of what I did for design. I like making things flexible so I can iterate quickly, or drive other pieces of design via expression.

You can control the spacing of the numbers two ways:

  • With the Leading value in the character panel (not flexible)

  • Using a Line Spacing text animator (flexible)

Leading set to 267px

Leading set to 267px

Text animator

Text animator


For color I created the background as the main element and the small square and the top bar are shapes with blend modes. The board background has 3 sliders for RGB values that have random(0,255) for a value. Color accepts a 4 part array [r,g,b,a] with values between 0 and 1.

color-set-up-BINGO.png

It’s fun to look at the post-expression graph for color

color-post-expression-graph.png

Wrap up

I can now use this to create as many combinations as I want. I could design the entire card in After Effects or export a PNG sequence of only numbers and do with it as I please. I think extending the card to work with Master Properties for design and animations would be the next step for this. The possibilities are endless with BINGO.

Feel free to download my project file here.

Tags: After Effects, Tutorial, Free Download
Prev / Next

Thoughts

Here’s where I share updates on current work, retrospectives on past projects, and other bits and pieces of writing.


Featured Posts

Featured
Mar 15, 2022
Dogs and cats in space with Ian Buchbinder | And Their Craft Episode 2
Mar 15, 2022
Mar 15, 2022
Jan 3, 2021
Sky image and texture pack | download
Jan 3, 2021
Jan 3, 2021
Oct 1, 2019
And Their Craft Episode 1
Oct 1, 2019
Oct 1, 2019
Sep 17, 2019
Bingo Card Generator
Sep 17, 2019
Sep 17, 2019
Aug 10, 2018
Using Animations to Improve Help Content at moo.com
Aug 10, 2018
Aug 10, 2018