Celebrating 2021
01 Jan 20212020 has been a rough year for everyone. The global population is suffering from the pandemic, unemployment and social injustice. Fortunately, 2020 is kinder towards me compared to others. Most notably, I was admitted by Purdue ECE as a PhD student, which enabled me to continue pursuing what I truly love. Being separated from my family across the ocean and kept out of my office due to social distancing restrictions, I experienced slight depression and reduced productivity from time to time. Hopefully, 2021 will be a better year for us all.
As usual, one cannot claim a year has actually started without finishing some “new year projects”. This time, I try to generate a fully vector-graphics based animation with the help of Python and LaTeX.
- GitHub: https://github.com/xziyue/2021-new-year-project
- The PDF file: https://github.com/xziyue/2021-new-year-project/raw/master/animation.pdf
The vector animation
We know that glyphs are represented with Bezier curves in font files. The points on Bezier curves can be extracted with freetype
library. After acquring all points, we can achieve the camera effect by multiplying points’ coordinates with a seris of model, view and projection matrices. To generate the animation:
- Run
extract_bezier.py
- Compile
animation.tex
Then the animation can be shown by opening animation.pdf with Acrobat Reader. If one wants to generate the MP4 file, run generate_mp4.py
. The total frame number should be correctly set in extract_bezier.py
, animation.tex
and generate_mp4.py
.