flash on 2012-12-8
/**
* Copyright kian ( http://wonderfl.net/user/kian )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3fP4
*/
package {
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.TimerEvent;
import flash.geom.Point;
import flash.utils.Timer;
import flash.filters.BevelFilter;
import flash.filters.DropShadowFilter;
import flash.ui.Mouse;
public class Main extends Sprite {
private var num:uint=40;
private var vel:Number=2.2;
private var timer:Timer;
private var puntos:Array;
private var dibu:Shape;
public function Main():void {
puntos=new Array();
for (var i:uint=0; i < num; i++) {
puntos.push(new Point(190,190));
}
// - Dibujo
dibu = new Shape();
addChild(dibu);
// - Filters
filtros(dibu,1.9,0x999999,0,45);
// - Timer
timer=new Timer(16);
timer.addEventListener("timer",mueve);
timer.start();
// - Escondemos el Mouse
Mouse.hide();
}
private function mueve(e:TimerEvent):void {
// - Mouse
puntos[0].x=mouseX;
puntos[0].y=mouseY;
// - Dibuja
dibu.graphics.clear();
dibu.graphics.moveTo(puntos[0].x,puntos[0].y);
for (var i:uint=1; i < num; i++) {
dibu.graphics.lineStyle(num-i, 0x123456);
var p1:Point=puntos[i];
var p2:Point=puntos[i-1];
p1.x += (p2.x - p1.x) / vel;
p1.y += (p2.y - p1.y) / vel;
dibu.graphics.lineTo(p1.x,p1.y);
}
}
// - Filters
private function filtros(mc:Shape, grosor:Number, col:uint, espacio:Number, angulo:uint):void {
var filterArray:Array = new Array();
// - Volumen
filterArray.push(new BevelFilter(1, -45, 0x000000, .5, 0x12345f, .0, 10, 10, 100, 3));
// - Borde
filterArray.push(new DropShadowFilter(espacio, angulo, col, 100, grosor, grosor, 100, 3));
// - Sombra
filterArray.push(new DropShadowFilter(3, 135, 0x019997, .15, 2, 2, 100, 1));
mc.filters = filterArray;
}
}
}