Escher

Code Actionscript 2.0

Frame action

i = 1;

for (gx = 0; gx <= 7; gx = gx + 1) {

for (gy = 0; gy <= 4; gy = gy + 1) {

i = i + 1;

tile0.duplicateMovieClip("tile" + i, i);

_root["tile" + i]._x = gx * 58;

// alternate between 0 and 1

alternation = gx % 2;

if (alternation == 0) {

// if column number is even -> no vertical offset

_root["tile" + i]._y = gy * 116;

} else {

// if column number is odd -> vertical offset is -58

_root["tile" + i]._y = gy * 116 - 58;

}

}

}

tile0._visible = 0;

Code Actionscript 3.0

var Tiles:Array = new Array(); var i = 1; for (var gx = 0; gx <= 7; gx = gx + 1) { for (var gy = 0; gy <= 4; gy = gy + 1) { i = i+1; //important: tile has to be exported for actionscript //go to "linkage" in library menu Tiles[i] = new tileObject(); Tiles[i].x = gx * 58; // alternate between 0 and 1 var alternation = gx % 2; if (alternation == 0) { // if column number is even -> no vertical offset Tiles[i].y = gy * 116 } else { // if column number is odd -> vertical offset is -58 Tiles[i].y = gy * 116 - 58; } addChild(Tiles[i]); } } tile0.visible = false;

Description

With this example, we would like to refer to the works of M.C. Escher, in which symmetries play a crucial role. One initial tile is repeatedly copied and generates a pattern, covering the entire area. The underlying symmetry is a translation symmetry, i.e. the basic element is offset vertically by 58 pixels in every other column. To achieve this, it is sufficient to start every second column with a vertical offset.

Download

Right click: Flashfile AS 2.0 | Flashfile AS 3.0 | SWF-File