Take a look at this function I wrote to draw the four basic math operators!

```
var operator = function(id, s){
if(id === "*"){
rotate(45);
}
//Horizontal Line
line(-s, 0, s, 0);
switch(id){
case "+": case "*":
//Vertical Line
line(0, -s, 0, s);
break;
case "/":
//Dots
point(0, -s);
point(0, s);
}
};
```

This function takes a string `id`

, which can be one of `"+"`

, `"-"`

, `"*"`

, and `"/"`

(addition, subtraction, multiplication, and division respectively). `s`

specifies the “size” of the operator – all elements drawn will be based on coordinates that are exactly `s`

units away from the center.

No matter which of the four operators this function we’re passed, we draw a horizontal line spanning from `-s, 0`

to `s, 0`

. By itself, the horizontal line can serve as a minus sign. But for the other three symbols, we have to add more. If the operator is `"/"`

, we draw two dots above and below the minus sign to make the division symbol. If the operator is `"+"`

or `"*"`

, we draw a vertical line crossing the minus sign. To turn this plus sign to a multiplication symbol, we rotate by 45 degrees if the operator is `"*"`

.

## That’s one jittery critter.

It kind of looks like something you’d see in a hand-drawn flip-book animation – stationary objects seem to wiggle in place because the lines are slightly different each time you draw them.

The dinosaur’s jitter effect was be achieved by translating each math symbol to a random position within a 1-pixel range from its original location.

Paleontologists who have studied the remains of the long lost Calculosaurus species have developed a classification system based on “jitteriness” levels – the harder the challenge, the more excited and jittery a Calculosaurus becomes. A 1-pixel jitteriness factor might describe a Calculosaurus warming up with basic arithmetic, such as the one pictured above. A jitteriness level of 3 pixels might describe a Calculosaurus performing linear algebra.

When differential calculus starts to get involved, the jitteriness level itself starts to jitter up and down:

There came a fateful day when the entire Calculosaurus population thought it would be exciting to try dividing by zero. Unfortunately, they got too excited and the excessive level of jitteriness drove the species to extinction.

PortalisOctober 19, 2015 at 11:21 amNice