GitHub - skeeto/sort-circle: Colorful sorting animations
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
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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK