<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: TOOL REEL</title>
    <description>The latest articles on DEV Community by TOOL REEL (@toolreel11).</description>
    <link>https://dev.to/toolreel11</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4250868%2F53d3ca7e-734f-452d-bad9-943c4194d048.png</url>
      <title>DEV Community: TOOL REEL</title>
      <link>https://dev.to/toolreel11</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/toolreel11"/>
    <language>en</language>
    <item>
      <title>The Math Behind an Infinite Zoom: Planning Nested Frames So the Loop Never Breaks</title>
      <dc:creator>TOOL REEL</dc:creator>
      <pubDate>Wed, 18 Nov 2026 03:45:30 +0000</pubDate>
      <link>https://dev.to/toolreel11/the-math-behind-an-infinite-zoom-planning-nested-frames-so-the-loop-never-breaks-199n</link>
      <guid>https://dev.to/toolreel11/the-math-behind-an-infinite-zoom-planning-nested-frames-so-the-loop-never-breaks-199n</guid>
      <description>&lt;p&gt;An infinite zoom is a sequence of images where each new picture lives inside the centre of the previous one. Play them back with a smooth scale and the camera seems to fall forward forever. It looks like magic, but it is really just a bit of geometry plus some careful prompt planning. Here is how I think about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Every frame is the previous frame, scaled down
&lt;/h2&gt;

&lt;p&gt;Pick a zoom factor &lt;code&gt;k&lt;/code&gt;, for example 2. Frame &lt;em&gt;n+1&lt;/em&gt; is pasted into the centre of frame &lt;em&gt;n&lt;/em&gt; at &lt;code&gt;1/k&lt;/code&gt; of its width. During playback you scale the whole stack continuously from 1x to &lt;code&gt;k&lt;/code&gt;x, and the moment you reach &lt;code&gt;k&lt;/code&gt;x the inner frame fills the screen. That is the cut point, and nobody notices it because the picture on screen hasn't changed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;frame_scale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;2.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;frames&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""t in [0, 1) over the whole video -&amp;gt; (frame index, scale of that frame)."""&lt;/span&gt;
    &lt;span class="n"&gt;pos&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;frames&lt;/span&gt;                 &lt;span class="c1"&gt;# which hand-off we are in&lt;/span&gt;
    &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;local&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pos&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;                  &lt;span class="c1"&gt;# 0..1 inside this hand-off&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;frames&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;local&lt;/span&gt;    &lt;span class="c1"&gt;# geometric, not linear, growth&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The detail that trips people up is the growth curve. Scale has to grow &lt;strong&gt;geometrically&lt;/strong&gt; (&lt;code&gt;k ** local&lt;/code&gt;), not linearly. A linear ramp makes each hand-off speed up and then stall, and the viewer feels a little "bump" at every seam.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The centre of each frame is reserved
&lt;/h2&gt;

&lt;p&gt;Because the next scene is pasted into the middle &lt;code&gt;1/k&lt;/code&gt; of the frame, that area is effectively a window. When you describe a scene, plan what sits there:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a doorway, a window, a picture frame, a pupil, a coin, a screen&lt;/li&gt;
&lt;li&gt;something with a clear edge, so the inner image has a natural border&lt;/li&gt;
&lt;li&gt;not text, and not a busy texture, which will show the seam&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. One connecting detail per hand-off
&lt;/h2&gt;

&lt;p&gt;Write the whole path as one line before generating anything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mountain valley -&amp;gt; cabin window -&amp;gt; desk by the window -&amp;gt; photo on the desk -&amp;gt; face in the photo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each arrow is a hand-off, and each one needs a single object that exists in both scenes. Describe that object with the same words (colour, material, shape) in both prompts. That repetition is what makes two separately generated images read as one continuous shot.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Keep light and palette locked
&lt;/h2&gt;

&lt;p&gt;Choose one light direction and three or four colours for the whole chain. Geometry can line up perfectly and the loop will still feel broken if frame 4 is warm sunset and frame 5 is cold noon.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Close the loop
&lt;/h2&gt;

&lt;p&gt;For a true loop, the last scene's centre should contain the first scene. A good trick is to let the final detail be an object that already appeared, small, in frame 1. Then &lt;code&gt;i % frames&lt;/code&gt; in the function above wraps around cleanly.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Test as thumbnails
&lt;/h2&gt;

&lt;p&gt;Before final renders, lay all frames out as small thumbnails in a row. At that size you only see shapes and colours, which is exactly what the eye tracks during a fast zoom. Any frame whose central shape jumps is the one to regenerate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tooling
&lt;/h2&gt;

&lt;p&gt;You can do all of this by hand: generate each frame with your favourite image model, then composite and animate with a short script (Pillow plus ffmpeg is enough). If you'd rather skip the compositing, &lt;a href="https://infinitezoomimage.com/" rel="noopener noreferrer"&gt;Infinite Zoom Art&lt;/a&gt; takes a list of scene descriptions and builds the looping zoom in the browser. Either way, the planning steps above are what decide whether the result feels seamless.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Pick a zoom factor and grow scale geometrically.&lt;/li&gt;
&lt;li&gt;Reserve the centre of every frame for the next scene.&lt;/li&gt;
&lt;li&gt;One shared, identically described detail per hand-off.&lt;/li&gt;
&lt;li&gt;Fixed light direction and palette.&lt;/li&gt;
&lt;li&gt;Last frame contains the first.&lt;/li&gt;
&lt;li&gt;Check the chain as thumbnails.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you try this, I'd love to see the path you wrote down. More looping zoom examples are on &lt;a href="https://infinitezoomimage.com/" rel="noopener noreferrer"&gt;Infinite Zoom Art&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>generativeart</category>
      <category>ai</category>
      <category>python</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
