Y
YamaT
Beta
Usuário com poucas negociações! Use sempre o saldo do ForoBeta!
Hola, mi objetivo es que solo cuando mi pagina se cargue se muestre una animacion en el centro de la pantalla, la cual es esta:
Rasengan - wonderfl build flash online
El codigo es este
Rasengan - wonderfl build flash online
El codigo es este
HTML:
package{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.GradientType;
import flash.display.GraphicsBitmapFill;
import flash.display.GraphicsGradientFill;
import flash.display.GraphicsPath;
import flash.display.GraphicsSolidFill;
import flash.display.GraphicsStroke;
import flash.display.GraphicsTrianglePath;
import flash.display.IGraphicsData;
import flash.display.Sprite;
import flash.display.TriangleCulling;
import flash.events.Event;
import flash.filters.BlurFilter;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
import flash.geom.Matrix3D;
import flash.geom.PerspectiveProjection;
import flash.geom.Point;
import flash.geom.Utils3D;
import flash.geom.Vector3D;
public class Rasengan extends Sprite{
private var p:Vector.<Point> = new Vector.<Point>();
private var v:Vector.<Point> = new Vector.<Point>();
//private var c:Vector.<int> = new Vector.<int>();
private var container:Sprite = new Sprite();
private var tex:Sprite = new Sprite();
private var texture:BitmapData = new BitmapData(400, 400, true, 0x000000);
private var sphere:Vector.<Number> = new Vector.<Number>();
private var gData:Vector.<IGraphicsData> = Vector.<IGraphicsData>([
//new GraphicsStroke(1, false, "normal", "none", "round", 1.0, new GraphicsSolidFill(0xFF0000, 0.5)),
new GraphicsGradientFill(GradientType.RADIAL, [0xEEFFFF, 0x63C5f8, 0x63C5f8, 0x73D5f8], [1, 0.95, 0.95, 0], [0x20, 0x80 , 0xC0, 0xFF], new Matrix(0.1, 0, 0, 0.1, 0, 0)),
new GraphicsPath(Vector.<int>([1, 2, 2, 2]), Vector.<Number>([-100,-100, 100,-100, 100,100, -100,100])),
new GraphicsBitmapFill(texture, null, true, true),
new GraphicsTrianglePath(new Vector.<Number>(), new Vector.<int>(), new Vector.<Number>(), TriangleCulling.NEGATIVE)
]);
private var ct:ColorTransform = new ColorTransform(1, 1, 1, 0.4);
public function Rasengan(){
for(var i:uint = 0; i < 100; i++){
p.push(new Point(Math.random()*texture.width, Math.random()*texture.height));
v.push(new Point(40*(Math.random()), 40*(Math.random()/10+1)));
//c.push(0x83E500+Math.round(0xFF*(0.9+Math.random()/10)));
}
createSphere(70, 15, 30, GraphicsTrianglePath(gData[3]), sphere);
container.x = stage.stageWidth/2;
container.y = stage.stageHeight/2;
container.filters = [new BlurFilter(3, 3, 1)];
//opaqueBackground = 0x000000;
//addChild(tex);
//addChild(new Bitmap(texture));
var m:Matrix3D = new PerspectiveProjection().toMatrix3D();
m.prependTranslation(0, 0, 400);
m.prependRotation(90, Vector3D.X_AXIS);
Utils3D.projectVectors(m, sphere, GraphicsTrianglePath(gData[3]).vertices, GraphicsTrianglePath(gData[3]).uvtData);
addChild(container);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(e:Event):void{
texture.colorTransform(texture.rect, ct);
tex.graphics.clear();
tex.graphics.lineStyle(2, /*c[i]*/0xFFFFFF);
for(var i:uint = 0; i < v.length; i++){
tex.graphics.moveTo(p[i].x, p[i].y);
tex.graphics.lineTo(p[i].x += v[i].x, p[i].y += v[i].y);
if(p[i].x > texture.width){
p[i].y -= v[i].y*(p[i].x-texture.width)/v[i].x;
p[i].x = 0;
}
if(p[i].y > texture.height){
p[i].y = 0;
}
}
texture.draw(tex);
container.graphics.clear();
container.graphics.drawGraphicsData(gData);
}
private function createSphere(radius:Number, N:uint, S:uint, trianglePathOut:GraphicsTrianglePath, vertices3DOut:Vector.<Number>):void{
for(var i:uint = 0; i <= N; i++){
for(var j:uint = 0; j <= S; j++){
vertices3DOut.push(
radius*Math.cos(2*Math.PI*j/S)*Math.sin(Math.PI*i/N),
-radius*Math.cos(Math.PI*i/N),
radius*Math.sin(2*Math.PI*j/S)*Math.sin(Math.PI*i/N)
);
trianglePathOut.uvtData.push(j/S, i/N, 1);
}
}
for(i = 0; i <= N; i++){
for(j = 0; j < S; j++){
var n:uint = i*S+j;
trianglePathOut.indices.push(n, n+1+S, n+1);
trianglePathOut.indices.push(n+1+S, n+2+S, n+1);
}
}
}
}
}