I implemented a very basic Serpiensky triangle with the following algorithm:
For each pixel (Px, Py)
if (Px & Py)
draw_pixel(Px, Py, color);
I was wondering if it's possible to implement a zoom simulation on that, to progressively and indefinitely "go" into the triangle with a nice animation. I can't wrap my head around the formula for that and didn't found anything even closely related on the web.
The algorithm you are using will produce something like this:
There can be different ways to obtain a zoom animation effect but the underlying principle is always the same. You display shifted & scaled versions of the original frame one-by-one at a fast rate.
Here, I am describing a very simplistic approach (assuming we reach the same state in T
seconds using N
steps):
N
th iteration? Goto step 2The choice of N
and T
depends on how fast and smooth you want the animation to be. The offsets and the scaling factor must be chosen such that: after N
steps of scaling and shifting, you are left with an image that looks pretty much identical to the starting (original) image.
An important point worth mentioning is that in order for this approach to yield a smooth (i.e. descent looking) animation will require the resolution of your computed Serpiensky triangle to be roughly 20-30 times of the display resolution.