126

GitHub - skeeto/sort-circle: Colorful sorting animations

 6 years ago
source link: https://github.com/skeeto/sort-circle
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Sorting Animations

68747470733a2f2f692e696d6775722e636f6d2f5071484c55566d2e706e67

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK