注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

.

.

 
 
 

日志

 
 

纯AS打造奇幻光影  

2008-09-01 10:28:41|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

效果:  

 

 打开动作面板,在场景中图层1的第一贞输入如下脚本:

 

 

/////////////////////////////////////////////

///// author: chenlangeer              //////

/////    msn: [email=chenlangeer@hotmail.com]chenlangeer@hotmail.com[/email]  //////

/////   blog: cgs.flash8.net           //////

/////////////////////////////////////////////

import flash.display.BitmapData;

import flash.filters.*;

import flash.geom.*;

_quality = "LOW";

_root.createTextField("logo", 10, 10, 10, 220, 18);

logo.html = true;

logo.htmlText = "<FONT FACE=’Arial’ SIZE=’14’ COLOR=’#FF9900’><A HREF=’http://cgs.flash8.net’ TARGET=’_blank’>Core Graph Studio</A>    </FONT><FONT FACE=’Arial’ SIZE=’12’ COLOR=’#999999’>click to redraw</FONT>";

_root.createTextField("para", 9, Stage.width-150, Stage.height-30, 150, 18);

para.html = true;

var bmp:BitmapData = new BitmapData(Stage.width, Stage.height, false, 0x0);

_root.attachBitmap(bmp, 0);

_root.createEmptyMovieClip("world", 2);

world.createEmptyMovieClip("_mc", 0);

world._mc._x = Stage.width/2;

world._mc._y = Stage.height/2;

var rad_speed:Number = 2;

var blurFilter:BlurFilter = new BlurFilter(2, 2, 1);

var f:Number = -.01;

var colorFilter:ColorMatrixFilter = new ColorMatrixFilter([.9, -.1, 0, 0, f, 0, .8, -.2, 0, f, .1, 0, .9, 0, f, 1, 0, 0, 1, 0]);

var total_nums:Number = 10;

onMouseDown = function () {

for (var i in world._mc) {

  world._mc[i].removeMovieClip();

}

var a = Math.random()*.2;

t = (Math.random()-.5)*a;

z = (Math.random()-.5)*a;

para.htmlText = "<FONT SIZE=’12’ COLOR=’#999999’>z="+Math.round(z*10000)/10000+"    t="+Math.round(t*10000)/10000+"</FONT>";

rad_speed = (Math.random()-.5)*3.8;

line_bool = random(5);

swirl_bool = random(3);

rnd_xy_bool = random(4);

var i = 0;

for (k=0; k<total_nums; k++) {

  for (m=0; m<360; m += 5) {

   var line:MovieClip = world._mc.createEmptyMovieClip("line"+i, i);

   if (rnd_xy_bool) {

    line.ox = line.__x=line._x=k*Math.sin(m/180*Math.PI)*8+Math.random()*20;

    line.oy = line.__y=line._y=k*Math.cos(m/180*Math.PI)*6+Math.random()*20;

   } else {

    line.ox = line.__x=line._x=k*Math.sin(m/180*Math.PI)*8;

    line.oy = line.__y=line._y=k*Math.cos(m/180*Math.PI)*6;

   }

   line.lx = line._x*.3;

   line.ly = line._y*.3;

   if (random(3)) {

    (new Color(line)).setTransform({rb:i*512/k/m-256, gb:i*255/k/m, bb:random(512)-256});

   } else {

    (new Color(line)).setTransform({rb:255, gb:255, bb:255});

   }

   line.onEnterFrame = function() {

    if (swirl_bool) {

     var x = this.__x;

     this.__x += 10*Math.cos(this.__y*z)*Math.sin(this.__y*t);

     this.__y += 10*Math.sin(x*z)*Math.cos(x*t);

    } else {

     this.__x += 10*Math.cos(this.__y*z)*Math.sin(this.__y*t);

     this.__y += 10*Math.sin(this.__x*z)*Math.cos(this.__x*t);

    }

    this.clear();

    this.lineStyle(1, 0x66EE66);

    if (line_bool>1) {

     this.moveTo(this.ox-this._x, this.oy-this._y);

     this.lineTo(this.__x-this._x, this.__y-this._y);

    } else if (line_bool == 1) {

     this.moveTo(this.ox, this.oy);

     this.lineTo(this.__x+this.lx, this.__y+this.ly);

    } else {

     this.moveTo(this.ox-this.lx, this.oy-this.ly);

     this.lineTo(this.__x-this.lx, this.__y-this.ly);

    }

    this.ox = this.__x;

    this.oy = this.__y;

   };

   i++;

  }

}

clearInterval(val);

val = setInterval(onMouseDown, 20000);

};

onEnterFrame = function () {

world._mc._rotation += rad_speed;

bmp.draw(world);

bmp.applyFilter(bmp, bmp.rectangle, new Point(0, 0), blurFilter);

bmp.applyFilter(bmp, bmp.rectangle, new Point(0, 0), colorFilter);

};

world._visible = false;

world._y = 100000;

onMouseDown();

测试影片  。呵呵,超简单。

  评论这张
 
阅读(237)| 评论(1)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017