# Tunnel: Iteration

**URL:** <https://forum.kirupa.com/t/tunnel-iteration/217122>\
**Category:** contests\
**Created:** [February 23, 2007, 6:54am UTC](https://forum.kirupa.com/t/tunnel-iteration/217122 "2007-02-23T06:54:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qwerty\_the\_Asdf](https://avatars.discourse-cdn.com/v4/letter/q/5e9695/32.png) [@Qwerty\_the\_Asdf](https://forum.kirupa.com/u/Qwerty_the_Asdf)\
**Post date:** [February 23, 2007, 6:54am UTC](https://forum.kirupa.com/t/tunnel-iteration/217122/1 "2007-02-23T06:54:32Z")

</div>

This code simulates traveling through a tunnel.

This is a _very_ early work I did (I had known flash for maybe only a month at the time). Since then I have reduced the code from around 50 lines to 25 with a bit more knowledge on actionscript, I’m still an actionscript newbie.

Just posting for some feedback. Thanks.

```auto
df = 1.015;
_root.onEnterFrame = function() {
    createIter = function() {
        i = 200;
        x=y=550;
        xi = -2;
        yi = -5;
        var iter = _root.createEmptyMovieClip("iteration", 1);
        with (iter) {
            lineStyle(1, 0xFF0000, 100);
            moveTo(x+50,y+100);
            while(i > 0) {
                lineTo((x/=xi)+50, y+100);
                lineTo(x+50, (y/=yi)+100);
                xi/=df;
                yi/=df;
                lineTo((x*=xi)+50, y+100);
                lineTo(x+50, (y*=yi)+100);
                xi*=df;
                yi*=df;
                i--;
            }
        }
        iteration._x = 150;
        df -= .0001;
    }
    createIter();
    iteration._alpha = (df-1)/.000045;
};

```
