主题:  火焰效果?

fenger

职务:普通成员
等级:2
金币:1.0
发贴:402
注册:2002/8/17 18:08:04
#12003/8/11 9:26:17
请教火焰实现方法,谢谢?



5DFlash Designer

职务:版主
等级:3
金币:10.0
发贴:1306
注册:2001/6/5 15:31:17
#22003/8/11 9:36:47
火焰的动画要注意热空气的对流,空气不断被火加热往上升,带动火焰的向上飘动,当升到一定的程度就会消失,然后又继续从下面开始。这里贴个效果给你看看!



5DFlash Designer

职务:版主
等级:3
金币:10.0
发贴:1306
注册:2001/6/5 15:31:17
#32003/8/11 9:38:28

Flash 动画

火焰。



fenger

职务:普通成员
等级:2
金币:1.0
发贴:402
注册:2002/8/17 18:08:04
#42003/8/11 9:55:50
效果的确不错,能把能讲讲实现方法,谢谢!



cbmdhy

职务:普通成员
等级:1
金币:1.0
发贴:174
注册:2003/7/23 2:55:40
#52003/8/11 11:12:38

Flash 动画

我了来一幅
这里是大图
www.5d.cn/bbs/uploadFiles/2003-08/111184331460.swf
不好意思,档案较大,可能要等一会。



cbmdhy

职务:普通成员
等级:1
金币:1.0
发贴:174
注册:2003/7/23 2:55:40
#62003/8/11 11:23:18
SORRY,时间不多,动画较粗糙,没有repeat



zqazy

职务:普通成员
等级:2
金币:1.0
发贴:375
注册:2001/7/24 23:17:57
#72003/8/11 17:14:08
offsetX = 275;
offsetY = 100;
left = 0;
right = 0;
top = 0;
leftGoal = 0;
rightGoal = 0;
topGoal = 0;
rate = .2;
decay = .9;
shapes = ["15|30", "10|50", "5|70", "0|100"];
for (var i = 0; i var name = "flame"+i;
createEmptyMovieClip(name, i);
_root[name]._x = offsetX;
_root[name]._y = offsetY;
_root[name].offset = parseInt(shapes[i].split("|")[0]);
_root[name].fade = parseInt(shapes[i].split("|")[1]);
}
createEmptyMovieClip("heat", i);
heat._x = offsetX;
heat._y = offsetY;
checkEdge = function (cur, side, dist) {
change = 0;
if (cur>side) {
change -= Math.random()*dist;
} else if (cur<-side) {
change += Math.random()*dist;
}
return change;
};
onEnterFrame = function () {
// change edge goals
leftGoal += Math.random()*6-3;
leftGoal += checkEdge(leftGoal, 10, 3);
rightGoal += Math.random()*6-3;
rightGoal += checkEdge(rightGoal, 10, 3);
topGoal += Math.random()*8-4;
topGoal += checkEdge(topGoal, 15, 4);
leftAccel = (leftGoal-left)*rate;
leftVeloc += leftAccel;
leftVeloc *= decay;
left += leftVeloc;
rightAccel = (rightGoal-right)*rate;
rightVeloc += rightAccel;
rightVeloc *= decay;
right += rightVeloc;
topAccel = (topGoal-top)*rate;
topVeloc += topAccel;
topVeloc *= decay;
top += topVeloc;
// make flames
for (var i = 0; i with (_root["flame"+i]) {
clear();
colors = [0xFCE39C, 0xF4AC35];
alphas = [_root["flame"+i].fade, _root["flame"+i].fade-20];
ratios = [70, 255];
matrix = {matrixType:"box", x:-50, y:50, w:100, h:200, r:0};
beginGradientFill("radial", colors, alphas, ratios, matrix);
lineStyle(1, 0x000000, 0);
moveTo(0-left+right, 0-top-_root["flame"+i].offset*2);
curveTo(40+_root["flame"+i].offset+right, 180, 0, 200);
curveTo(-40-_root["flame"+i].offset-left, 180, 0-left+right, 0-top-_root["flame"+i].offset*2);
endFill();
}
}
// adjust heat
with (_root.heat) {
clear();
colors = [0x986932, 0x986932];
alphas = [70, 0];
ratios = [20, 255];
matrix = {matrixType:"box", x:-20-left/2, y:120-top, w:40+right/2, h:120+top, r:0};
beginGradientFill("radial", colors, alphas, ratios, matrix);
lineStyle(1, 0x000000, 0);
moveTo(-50, 0);
lineTo(50, 0);
lineTo(50, 200);
lineTo(-50, 200);
lineTo(-50, 0);
endFill();
}
duplicateMovieClip(_root["flame"+(shapes.length-1)], "shapeMask", shapes.length+1);
heat.setMask(shapeMask);
};

说明:不是我写的。感谢作者。

编辑历史:[这消息被zqazy编辑过(编辑时间2003-08-11 17:18:19)]


风雨楼

职务:普通成员
等级:1
金币:0.0
发贴:91
注册:2003/5/22 18:13:56
#82003/8/12 9:35:40
shapes = ["15|30", "10|50", "5|70", "0|100"];

这个shapes的用法!!?