rss· 投稿· 设为首页· 加入收藏· 繁體版
当前位置: 火魔网 » 媒体动画 » Flash

pv3d 文字粒子效果

package{
    import flash.display.*;
    import flash.text.*;
    import flash.filters.*;
    import flash.geom.*;
    import caurina.transitions.Tweener;
import org.papervision3d.*;

    public class Foo extends Sprite{
        private var bd:BitmapData;
        public function Foo():void{
            var tf:TextField = new TextField();
            tf.textColor = 0x000000;
            tf.text = "spade-A\nWelcome you!";
            tf.autoSize = "left";     /*var tf=new ce();
    tf.width=60;
    tf.height=40;*/
    //文本 draw成BitmapData
            bd = new BitmapData(tf.width, tf.height, false,0x339900);
            bd.draw(tf);            // bd.applyFilter(bd, bd.rect, new Point(), new BlurFilter());
            //bd.draw(tf);     //循环排列
            for(var i:int = 0; i < bd.width; i++){
                for(var j:int = 0; j < bd.height; j++){
                    Tweener.addTween(
                        randomize(addChild(new Circle(bd.getPixel(i, j)))), //getPixel()用来按照位置获取颜色         //排列
                            x: (stage.stageWidth-tf.width*10)/2+(i * 10),
                            y: (stage.stageHeight-tf.height*10)/2+(j * 10),
                            alpha: 1,
                            delay: (i + j) * .2 * Math.random(),
                            time: 1                     );             }    //仿粒子
        private function randomize(d:DisplayObject):DisplayObject{
           d.x = 1000*Math.random();
            d.y = 400 * Math.random();
            d.alpha = 1;
            return d;     }
}

import flash.display.Sprite; class Circle extends Sprite{
    public function Circle(color:uint):void{
        graphics.beginFill(color);
        graphics.drawCircle(0, 0, 6);
        graphics.endFill(); }

顶一下
(0)
踩一下
(0)