Tag Archives: gif

Making Math GIFs

Standard

Few months ago I wrote about the technologies we use today to share joy of mathematics. But, I overlooked one very important tool which we can use today: Graphics Interchange Format (GIF). For example, see this Tumblr blog: matan-matika.

Though I used this “technology” in one of my posts earlier this year, I didn’t know how to create my own animated GIF images.  So I started searching and stumbled on an HTML5 application by Pascal Bauermeister called MathVision . It is capable of generating mathematical art pictures using the contour plot technique. It uses simplified Java syntax and can be easily learnt by following this Instructable.

As an exercise in this Instructable, we are asked to make diagonal stripes, here is my attempt:

WIDTH = 350;
RATIO = 1;
X_MIN = 0; X_MAX = 10;
Y_MIN = 0; Y_MAX = 10;

color rgb(x, y) {
  int bu = y+x;
  int value = (int)bu % 2;
  int luma = value * 255;
  return color(luma);
}

gif1

Here is a “disturbing” animated spiral (note that it’s spinning in the direction opposite to the one given in instructable; just need to decrement time):

TIME_INCREMENT = 0.1;
FRAMES = 10;
FRAMES = TWO_PI / TIME_INCREMENT / 3;
OUT_PAUSE = false;
WIDTH = 250;
RATIO = 1;
X_MIN = -1; X_MAX = 1;
Y_MIN = -1; Y_MAX = 1;

color rgb(x, y, t) {
float radius = dist(x, y, 0, 0);
float angle = -atan2(x, y);
angle = angle - t;

float value = angle*3 - (radius)*12;
float stripe = cos(value);

float luma = (stripe - 5) * 127;
return color(luma);
}

disturbing

Today, 6-10-2016, is a Palindrome Day (if written in dd-mm-yyyy format)! So I end my post with this GIF I recorded using byzanz (on Ubuntu) and edited using ezgif.com:

ezgif-com-gif-maker