Have you ever wanted to dive into infinity? 🌌 In this video, we write a two-part Python project to generate a mesmerizing, perfectly looping zoom into a specific mathematical fractal known as the "Dragon" Julia Set.
We don't use any pre-built animation software—everything you see is rendered from scratch using raw math, complex numbers, and Python!🛠️ What we cover in this video:
Part 1: The Math & The Art (NumPy & Matplotlib) We use complex plane mathematics to calculate the Julia Set formula ($Z_{n+1} = Z_n^2 + c$). We then apply a custom color gradient and logarithmic smooth shading to render 200 individual high-resolution image frames, zooming in exponentially by 85% each time.
Part 2: Assembly & Looping (OpenCV) Once the frames are generated, we use Python's OpenCV library to stitch them together at 10 FPS. To make the video loop perfectly, we programmatically reverse the frames to create a seamless "zoom in, zoom out" sequence.
Libraries Used:
numpy (For the heavy array and complex math calculations)
matplotlib (For plotting the data, applying colormaps, and saving the images)
opencv-python / cv2 (For reading the images and rendering the final .mp4 video)
os & re (For file management and sorting)
Resources & Code:
Get the full source code on my GitHub:
https://github.com/MarcosEngineering/...
https://github.com/MarcosEngineering/...
Read more about Julia Sets: https://en.wikipedia.org/wiki/Julia_set
Don't forget to Like and Subscribe if you want to see more coding projects, math art, and Python tutorials! Let me know in the comments what coordinates we should zoom into next. 👇