The Bridges Series

Bridge 1: Minimal Paths

My first attempt to render Brownian bridge paths (github source) was minimalist. I used the e1071 R package to generate 20 Brownian bridge paths in two dimensions cross 100 time points. Thanks to the joy of tidyverse it was surprisingly easy to keep the data organised, and better yet all the operations are vectorised: there's not a single loop involved. The animation is all handled using the gganimate package, and it was so smooth. This worked the first time I tried it, straight out of the box. Admittedly it was made easier by the fact that I already had the ffmpeg/gifski toolchain working on my machine. From what I've heard, that's the part that has caused other people some headaches.

Bridge 2: Summer School

My second attempt to render Brownian bridge paths using gganimate (github) was a little more ambitious. I'm teaching a summer school on computational modelling and data analysis in cognitive science in Melbourne in December and wanted to have a twitter-friendly way to advertise it. Most of the hard work in this was finding a nice bitmap font that I could use to define the location of the dots, and then finding suitable words to go on the two text states that would ensure that there are always 395 dots on screen. The animation itself is exactly the same trick as the first one, with Brownian bridges used to interpolate locations.

Bridge 3: Wear It Purple Day

My third attempt to render Brownian bridge paths using gganimate (github) arose because I wanted to tweet something for Wear It Purple Day this year, and especially because I'm a panellist at the UNSW Science discussion. Following some suggestions from Thomas Lin Pedersen I worked out how to smooth the paths (quadratic easing between frames) and have continuous shadow wake (upping the detail on the animate call). I also adapted the code to interpolate the colour aesthetic smoothly so that the first text frame uses the six colours of the LGBT flag, while the second one is entirely purple.

Bridge 4: The Shrieking Eels

My fourth attempt to do something with Brownian bridge paths in gganimate (github) turned out... weird. The image of Sydney harbour bridge I made myself as ASCII art. Unlike the earlier animations the Brownian motion paths are smoothed so you don't see any sharp transitions between locations. I also played around with the easing on the shadow wake, which produced the long eel-like shapes. Given how much my kids love the eels at the Botanic gardens, how could I say no?