Sketches: moving clip to top on click

Sticky Elemental Snow


This is just a simple little widget I built for myself to use in a presentation. While giving my talk, I wanted to click on one of the squares and bring it to the front. The resulting swf was imported into my presentation swf.

The content is a series of little sketches, with pen on paper, where I'm figuring out an algorithm for dividing a square into smaller squares over several iterations.

The first iteration is simple. Just get the width of the box, and draw lines at the half-way mark. So, if we just look at the width and ignore the height for now,

p1.x = w1 = w0/2

For the next iteration, I want to draw a new line between the edge and the first line.

p2a.x = w2 = w1/2

Now, I could draw another line w2 distance from the one started at p2. However, I'd like to skip over the previously drawn line and draw a new line between the first line and the far edge of the box. To do this, I need the last gap and add that to my starting point for this iteration.

p2b.x = p2a.x + w1