# Math

**URL:** https://forum.kirupa.com/t/math/217050
**Category:** Uncategorized
**Created:** [February 22, 2007, 4:34pm UTC](https://forum.kirupa.com/t/math/217050 "2007-02-22T16:34:15Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Syous](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@Syous](https://forum.kirupa.com/u/Syous)
#### Post date: [February 22, 2007, 4:34pm UTC](https://forum.kirupa.com/t/math/217050/1 "2007-02-22T16:34:15Z")

</div>

This code is for a square transition effect…the squares fade from top to bottom and are opaque. I have some actionscript and it works, it’s just too slow and I was wondering where in the code I’d change a variable to speed it up a bit.

```auto

function drawGrid(theWidth:Number, theHeight:Number, imageClip:MovieClip):Void {
    var initDot = new Object();
    var k:Number = 0;
    // Create a mask clip to hold all the dots
    this.createEmptyMovieClip("mask", 1);
    // Assign it as the masking clip
    imageClip.setMask(mask);
    for (var i:Number = 0; i<theWidth; i += 20) {
        for (var j:Number = 0; j<theHeight; j += 20) {
            var dotName:String = "dot"+i+"_"+j;
            initDot._x = i;
            initDot._y = j;
            initDot.timer = Math.ceil(Math.random( )*800)+(((initDot._y+(initDot._x/20))*1)/1);
            // Place the masking dots within the container mask clip
            mask.attachMovie("dot", dotName, k, initDot);
            k++;
        }
    }
}
drawGrid(900, 600, image1_mc);

```
