HELLO
/**
* Copyright hipoca ( http://wonderfl.net/user/hipoca )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/hXbc
*/
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Shape;
import flash.display.Sprite;
import caurina.transitions.Tweener;
public class FlashTest extends Sprite {
public function FlashTest() {
helloWorld();
}
private function helloWorld():void{
var lines:Array = new Array();
//H
var line:Object = new Object();
line = {"startX":0,"startY":0,"endX":0,"endY":90};
lines.push(line);
line = {"startX":0,"startY":45,"endX":40,"endY":45};
lines.push(line);
line = {"startX":40,"startY":0,"endX":40,"endY":90};
lines.push(line);
//E
line = {"startX":50,"startY":0,"endX":50,"endY":90};
lines.push(line);
line = {"startX":50,"startY":0,"endX":90,"endY":0};
lines.push(line);
line = {"startX":50,"startY":45,"endX":90,"endY":45};
lines.push(line);
line = {"startX":50,"startY":90,"endX":90,"endY":90};
lines.push(line);
//L
line = {"startX":100,"startY":0,"endX":100,"endY":90};
lines.push(line);
line = {"startX":100,"startY":90,"endX":140,"endY":90};
lines.push(line);
//L
line = {"startX":150,"startY":0,"endX":150,"endY":90};
lines.push(line);
line = {"startX":150,"startY":90,"endX":190,"endY":90};
lines.push(line);
//O
line = {"startX":200,"startY":0,"endX":200,"endY":90};
lines.push(line);
line = {"startX":200,"startY":90,"endX":240,"endY":90};
lines.push(line);
line = {"startX":200,"startY":0,"endX":240,"endY":0};
lines.push(line);
line = {"startX":240,"startY":0,"endX":240,"endY":90};
lines.push(line);
var words:Sprite = drawStrings(lines);
addChild(words);
words.x = 5;
words.y = 5;
}
private function drawStrings(arry:Array):Sprite{
var delayTime:Number = 0;
var lines:Array = arry;
var words:Sprite = new Sprite();
for(var i:int=0; i<lines.length; i++){
var length:int = 0;
if(lines[i].startX == lines[i].endX ){
length = lines[i].endY - lines[i].startY;
}else{
length = lines[i].endX - lines[i].startX;
}
for(var j:int=0; j<=length; j++){
var rc:Shape = drawRect();
rc.x = Math.floor(Math.random()*500);
rc.y = Math.floor(Math.random()*500);
words.addChild(rc);
delayTime++;
if(lines[i].startX == lines[i].endX ){
Tweener.addTween(rc,{x:lines[i].startX,y:j,time:1.5,delay:0.001*delayTime});
}else{
Tweener.addTween(rc,{x:j+lines[i].startX,y:lines[i].startY,time:1.5,delay:0.001*delayTime});
}
}
}
return words;
}
private function drawRect():Shape{
var rc:Shape = new Shape();
rc.graphics.beginFill(0x000000);
rc.graphics.drawRect(0,0,1,1);
rc.graphics.endFill();
return rc;
}
}
}