Sorting Animations
This C program produces videos for various sorting algorithms. Points are ordered by hue, and the distance from the center indicates a point's distance from its correct position. The original idea for this animation comes from w0rthy.
To create a video, pipe standard output into a video encoder:
$ ./sort | x264 --fps 60 -o video.mp4 /dev/stdin
Some media players can play raw video from standard input as well:
$ ./sort | mpv --no-correct-pts --fps=60 -
Others need help from mjpegtools (ppmtoy4m
):
$ ./sort | ppmtoy4m -F60:1 | vlc -
The program's output is a bunch of concatenated images, one per frame, in PPM format.