as3 火燃烧效果实现代码
private function update(e:event):void {
target.filters = [new displacementmapfilter(bmd, new point(), bitmapdatachannel.red,bitmapdatachannel.red, 10, strengh, "clamp")];
offset=offset.add(v);
bmd.perlinnoise(size / 2, size, 3, randomseed, false, true, 1, true, [offset, offset]);
}
main.as文件代码
package
{
import flash.display.sprite;
import effects.fireeffect;
import flash.events.mouseevent;
import flash.net.navigatetourl;
import flash.net.urlrequest;
import flash.text.textfield;
/**
* ...
* @author sliz
*/
public class main extends sprite
{
public function main():void {
addchild(new fireeffect());
var lable:textfield = new textfield();
lable.textcolor = 0xffffff;
lable.selectable = false;
lable.text = "sliz";
lable.addeventlistener(mouseevent.click, function():void { navigatetourl(new urlrequest("/space/?534614/")); } );
addchild(lable);
lable.x = 370;
lable.y = 380;
}
}
}
fireeffect.as代码
package effects
{
import flash.display.*
import flash.events.event;
import flash.filters.displacementmapfilter;
import flash.geom.*
/**
* ...
* @author sliz
*/
public class fireeffect extends sprite
{
private var bmd:bitmapdata;
private var target:sprite = createsharp(400, 30,0);
private var speed:number = math.random() * 4 + 4;
private var strengh:number = math.random() * 60 + 60;
private var size:number = math.random() * 17 + 20;
private var randomseed:number = math.floor(math.random() * 10);
private var offset:point = new point();
private var v:point;
private var w:number = 50;
public function fireeffect()
{
addchild(target);
addto(target);
target.x = 0;
target.y = 200;
}
private function createsharp(width:number,height:number,angle:number):sprite {
var s:sprite = new sprite();
s.graphics.beginfill(0, 0);
s.graphics.drawrect( -w, -w, width + 2 * w, w);
s.graphics.beginfill(0xffffff);
s.graphics.drawrect( -w, height, width + 2 * w, w);
var filltype:string = gradienttype.linear;
var colors:array = [0x900000, 0x900000,0xff9900,0xfffd8a,0xffffff];
var alphas:array = [0,1,1,1, 1];
var ratios:array = [0x00,0xff/16,0xff*2/6,0xff*2/3, 0xff];
var matr:matrix = new matrix();
matr.creategradientbox(width, height, math.pi / 2);
var spreadmethod:string = spreadmethod.pad;
s.graphics.begingradientfill(filltype, colors, alphas, ratios, matr, spreadmethod);
s.graphics.drawrect(0, 0, width, height);
return s;
}
public function addto(target:object):void {
bmd = new bitmapdata(target.width, target.height);
v = new point(math.random() * (speed / 4) - speed / 8,math.random() * (speed / 4) + speed / 4 * 3);
target.addeventlistener(event.enter_frame, update);
}
private function update(e:event):void {
target.filters = [new displacementmapfilter(bmd, new point(), bitmapdatachannel.red,bitmapdatachannel.red, 10, strengh, "clamp")];
offset=offset.add(v);
bmd.perlinnoise(size / 2, size, 3, randomseed, false, true, 1, true, [offset, offset]);
}
}
}
我的博物馆故事 官方安卓版v1.61.2
我的博物馆故事是一款以消除为主题的经营养成类手游,在这里玩家
专业模拟飞行10 手机版v12.2.4
专业模拟飞行10安卓版是一款飞行休闲手游,顶尖的物理飞行引擎
动物起义战斗模拟器二琳同款 最新版v4.1.1
动物起义战斗模拟器是一个非常有趣的模拟类游戏,玩家可以召唤各
迷你世界七周年 安卓手机版v1.43.0
迷你世界7周年是一款由《迷你世界》官方推出的庆祝特别版本,在
劫后公司无限资源版 v1.0.5.1
劫后公司内置菜单版是游戏的破解版本,在该版本中为玩家提供了内