达达首页 | 设计教程 | 辅助工具 | 字体字库 | 素材贴图 | 非 主 流 | PS 笔刷 | 签名模版 | 网页模版 | 达达贴吧
设为首页

加入收藏

联系我们
PhotoShop 教程 | Illustrator 教程 | CorelDraw 教程 | FireWorks 教程 | 3D MAX 教程 | MAYA 教程 | Flash 教程 | After Effects 教程
相关教程
普通教程 用Flash 8 制作简单…
普通教程 Flash8制作一个效果…
普通教程 Flash常见动画制作分…
普通教程 Flash制作四种3D隧道…
普通教程 露一小手闪晕你——…
普通教程 Flash8简单制作飞速…
普通教程 Flash制作好看的影片…
普通教程 Flash制作星星写字特…
普通教程 如何在FLASH中实现眨…
普通教程 Flash动画技巧:人侧…
最新更新

Photoshop结合Fla…

Photoshop结合Fla…

Photoshop结合Fla…

Flash绘画技巧:绘…
您现在的位置: 达达派 >> 教程中心 >> FLASH教程 >> 动画篇 >> 教程正文
Flash AS制作下雪动画效果
作者:佚名 文章来源:网络采集 点击数: 更新时间:2007-4-24 22:27:28
教程录入:猩猩    责任编辑:猩猩  添加到雅虎收藏+
使用纯Flash Actionscript实现的下雪动画效果。

效果演示:

制作方法是把下面的代码直接放到新建立的Flash文档的第1帧里面:

function addMasker()
{
_root.createEmptyMovieClip("masker", -2);
with (masker)
{
lineStyle(1, 13421772, 100);
beginFill(0, 100);
moveTo(sideDisWidth, sideDisHeight);
lineTo(sideDisWidth + sceneWidth, sideDisHeight);
lineTo(sideDisWidth + sceneWidth, sideDisHeight + sceneHeight);
lineTo(sideDisWidth, sideDisHeight + sceneHeight);
endFill();
} // End of with
createSnow();
} // End of the function
function createSnow()
{
var _l1 = 0;
while (_l1 < snowNum)
{
var _l2 = snowSpace.createEmptyMovieClip("s" + _l1, _l1);
var _l3 = Math.random() * 3;
drawSnow(_l2, _l3);
_l1++;
} // end while
} // End of the function
function drawSnow(snow, radius)
{
var p = radius * 0.900000;
with (snow)
{
colors = [13421772, 16777215];
alphas = [100, 100];
ratios = [0, 255];
matrix = {matrixType: "box", x: -Math.random() * 2 * radius, y: -Math.random() * 2 * radius, w: 2 * radius, h: 2 * radius, r: 1.570796};
beginGradientFill("radial", colors, alphas, ratios, matrix);
curveTo(p, -p, radius, 0);
curveTo(p, p, 0, radius);
curveTo(-p, p, -radius, 0);
curveTo(-p, -p, 0, -radius);
endFill();
} // End of with
snowProperty(snow, sceneWidth, sceneHeight);
} // End of the function
function snowProperty(snow, w, h)
{
snow._x = sideDisWidth + Math.random() * w;
snow._y = sideDisHeight + Math.random() * h;
snow._rotation = Math.random() * 120 + 30;
snow.stepX = Math.cos(snow._rotation * 3.141593 / 180);
snow.stepY = Math.random() * 2 + 1;
setInterval(snowFall, 30, snow);
} // End of the function
function snowFall(snow)
{
snow._x = snow._x + snow.stepX;
snow._y = snow._y + snow.stepY;
if (sideDisWidth > snow._x)
{
snow._x = sideDisWidth + sceneWidth;
} // end if
if (sideDisWidth + sceneWidth < snow._x)
{
snow._x = sideDisWidth;
} // end if
if (sideDisHeight + sceneHeight < snow._y)
{
snow._y = sideDisHeight;
} // end if
} // End of the function
var sceneWidth = 550;
var sceneHeight = 400;
var sideDisWidth = Stage.width / 2 - sceneWidth / 2;
var sideDisHeight = Stage.height / 2 - sceneHeight / 2;
var snowNum = 150;
var snowSpace = _root.createEmptyMovieClip("room", 1);
addMasker();

  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    关于我们 | 帮助(?) | 广告服务 | 版权声明 | 商业合作 | 发展历程 | 联系我们

    Copyright ? 2005-2008 CGFancy.com, All Rights Reserved,达达网络:陕ICP备06010337号

    技术交流:71125455(平面)、545534707(三维),业务合作:71125455