# Fractal zoom animation

**URL:** <https://discourse.processing.org/t/fractal-zoom-animation/23727>\
**Category:** Project Guidance\
**Created:** [September 7, 2020, 8:13pm UTC](https://discourse.processing.org/t/fractal-zoom-animation/23727 "2020-09-07T20:13:24Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![raron](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/raron/32/13651_2.png) [@raron](https://discourse.processing.org/u/raron)\
**Post date:** [September 16, 2020, 12:48pm UTC](https://discourse.processing.org/t/fractal-zoom-animation/23727/14 "2020-09-16T12:48:11Z")

</div>

Great answer, thanks!

Probably of no use, just to show the idea roughly:

![Koch curve by noel modded](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8f0c2d55e3f201b16d03633eeb88b3756a022198.png)

> **Modified your Rosetta page code a bit**
>
> ```auto
> int l = 300;
>  
> void setup() {
> size(400, 400);
> background(0, 0, 255);
> stroke(255);
> // draw from center of screen
> translate(width/2.0, height/2.0);
> // center curve from lower-left corner of base equilateral triangle
> translate(-l/2.0, l*sqrt(3)/6.0);
> for (int i = 1; i <= 3; i++) {
> kcurve(0, l);
> rotate(radians(120));
> translate(-l, 0);
> }
> }
>  
> void kcurve(float x1, float x2) {
> float s = (x2-x1)/3;
>   
> float factor = (1-(screenY(x1+1.5*s, s*sqrt(3)/2)/height));
> float minLength = int(pow(factor,1.5)*50.0)+1;
> //println(s, minLength);
> float lineThickness = (factor+.25)*4;
> strokeWeight(lineThickness);
> 
> if (s < minLength) {
> pushMatrix();
> translate(x1, 0);
> line(0, 0, s, 0);
> line(2*s, 0, 3*s, 0);
> translate(s, 0);
> rotate(radians(60));
> line(0, 0, s, 0);
> translate(s, 0);
> rotate(radians(-120));
> line(0, 0, s, 0);
> popMatrix();
> return;
> }
> pushMatrix();
> translate(x1, 0);
> kcurve(0, s);
> kcurve(2*s, 3*s);
> translate(s, 0);
> rotate(radians(60));
> kcurve(0, s);
> translate(s, 0);
> rotate(radians(-120));
> kcurve(0, s);
> popMatrix();
> }
> 
> ```

It’s a bit exaggerated, and the lower part isn’t scaled up (zoomed in). Not sure how to do it with the zooming version.

---

_[View the full topic](https://discourse.processing.org/t/fractal-zoom-animation/23727)._
