Runes
Historical mysteries.
歴史の謎。
/**
* Copyright GreekFellows ( http://wonderfl.net/user/GreekFellows )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/5jMK
*/
package
{
import flash.display.Sprite;
import flash.geom.Point;
/**
* ...
* @author Greek Fellows
*/
public class Main extends Sprite
{
public function Main():void
{
var unit:int = 50;
for (var ver:int = unit; ver < 465; ver += unit) {
for (var hor:int = unit; hor < 465; hor += unit) {
rune(hor, ver, 20, 20, 3);
}
}
}
private function rune(x:Number, y:Number, width:Number, height:Number, offset:Number):void {
this.graphics.lineStyle(2, 0x000000, .2);
var p1:Point = new Point(x - width / 2, y - height / 2);
var p2:Point = new Point(x , y - height / 2);
var p3:Point = new Point(x + width / 2, y - height / 2);
var p4:Point = new Point(x - width / 2, y);
var p5:Point = new Point(x , y);
var p6:Point = new Point(x + width / 2, y);
var p7:Point = new Point(x - width / 2, y + height / 2);
var p8:Point = new Point(x , y + height / 2);
var p9:Point = new Point(x + width / 2, y + height / 2);
for (var it:int = 0; it < 12; it++) {
if (Math.floor(Math.random() * 2) == 0) {
for (var ra:int = 0; ra < 5; ra++) {
var r1x:Number = Math.floor(Math.random() * offset) - offset / 2;
var r1y:Number = Math.floor(Math.random() * offset) - offset / 2;
var r2x:Number = Math.floor(Math.random() * offset) - offset / 2;
var r2y:Number = Math.floor(Math.random() * offset) - offset / 2;
switch (it) {
case 0:
this.graphics.moveTo(p1.x + r1x, p1.y + r1y);
this.graphics.lineTo(p2.x + r2x, p2.y + r2y);
break;
case 1:
this.graphics.moveTo(p2.x + r1x, p2.y + r1y);
this.graphics.lineTo(p3.x + r2x, p3.y + r2y);
break;
case 2:
this.graphics.moveTo(p1.x + r1x, p1.y + r1y);
this.graphics.lineTo(p4.x + r2x, p4.y + r2y);
break;
case 3:
this.graphics.moveTo(p2.x + r1x, p2.y + r1y);
this.graphics.lineTo(p5.x + r2x, p5.y + r2y);
break;
case 4:
this.graphics.moveTo(p3.x + r1x, p3.y + r1y);
this.graphics.lineTo(p6.x + r2x, p6.y + r2y);
break;
case 5:
this.graphics.moveTo(p4.x + r1x, p4.y + r1y);
this.graphics.lineTo(p5.x + r1x, p5.y + r2y);
break;
case 6:
this.graphics.moveTo(p5.x + r1x, p5.y + r1y);
this.graphics.lineTo(p6.x + r2x, p6.y + r2y);
break;
case 7:
this.graphics.moveTo(p4.x + r1x, p4.y + r1y);
this.graphics.lineTo(p7.x + r2x, p7.y + r2y);
break;
case 8:
this.graphics.moveTo(p5.x + r1x, p5.y + r1y);
this.graphics.lineTo(p8.x + r2x, p8.y + r2y);
break;
case 9:
this.graphics.moveTo(p6.x + r1x, p6.y + r1y);
this.graphics.lineTo(p9.x + r2x, p9.y + r2y);
break;
case 10:
this.graphics.moveTo(p7.x + r1x, p7.y + r1y);
this.graphics.lineTo(p8.x + r2x, p8.y + r2y);
break;
case 11:
this.graphics.moveTo(p8.x + r1x, p8.y + r1y);
this.graphics.lineTo(p9.x + r2x, p9.y + r2y);
break;
}
}
}
}
}
}
}