国产乱视频网站_久久亚洲一区二区三区四区_免费高清一级毛片_国产精品电影_国产精品乱码一区二区三区_美女天堂网

PS設(shè)計教程網(wǎng)歡迎你!

Flash AS3教程:創(chuàng)建好看的遮罩動畫效果(2)

文章來源于 中國教程網(wǎng)論壇,感謝作者 cao4811 給我們帶來經(jīng)精彩的文章!
設(shè)計教程/設(shè)計教程/Flash教程2010-01-28
這是一個遮罩動畫效果教程,學(xué)習(xí)用代碼制作遮罩動畫。 演示: 1、準(zhǔn)備一張圖片。 2、新建一個500*300的Flash文件。(設(shè)置寬、高同圖片大。 3、導(dǎo)入圖片到庫中。 4、從庫中把圖片拖到舞臺上,左對齊,上對齊。 5、

這是一個遮罩動畫效果教程,學(xué)習(xí)用代碼制作遮罩動畫。

演示:

1、準(zhǔn)備一張圖片。

2、新建一個500*300的Flash文件。(設(shè)置寬、高同圖片大。

3、導(dǎo)入圖片到庫中。

4、從庫中把圖片拖到舞臺上,左對齊,上對齊。

5、右鍵點擊圖片,轉(zhuǎn)換成影片剪輯。元件名:“cityMC”。圖1:
Flash AS3教程:創(chuàng)建好看的遮罩動畫效果
6、在屬性面板中輸入實例名稱:“cityMC”。圖2:
Flash AS3教程:創(chuàng)建好看的遮罩動畫效果
7、鎖定圖層1,添加圖層2。用圓角矩形工具在舞臺上任意位置、任意顏色、畫一個圓角為10的40*40的矩形。圖3:
Flash AS3教程:創(chuàng)建好看的遮罩動畫效果
8、把圓角矩形轉(zhuǎn)換成影片剪輯,名稱為“maskMC”,注冊點居中。圖4:
Flash AS3教程:創(chuàng)建好看的遮罩動畫效果
9、刪除舞臺上的圓角矩形。打開庫右鍵單擊maskMC影片剪輯,選屬性作類鏈接,類名:“MaskRectangle” 圖5:
Flash AS3教程:創(chuàng)建好看的遮罩動畫效果
10、把圖層2改為as,輸入代碼:



//We need these classes for the animation

import fl.transitions.Tween;

import fl.transitions.easing.*;



//These are the mask rectangle’s width and height

var boxWidth:Number = 40;

var boxHeight:Number = 40;



//We want nine rows and 14 columns to make the animation look nice

var rows:Number = 9;

var columns:Number = 14;



//We will add the rectangle’s into an array (we need this array in the animation)

var rectangles:Array = new Array();



//We add the tweens into an array so they don’t get carbage collected

var tweens:Array = new Array();



//This container will hold all the mask rectangles

var container:Sprite = new Sprite();



//Add the container onto the stage

addChild(container);



//Set the container to be the image’s mask

cityMC.mask = container;



//Loop through the rows

for (var i=0; i < rows; i++) {



        //Loop through the columns

        for (var j=0; j < columns; j++) {



                //Create a new mask rectangle

                var maskRectangle:MaskRectangle = new MaskRectangle();



                //Position the mask rectangle

                maskRectangle.x = j * boxWidth;

                maskRectangle.y = i * boxWidth;



                //Set the scaleX to be 0, so the rectangle will not be visible

                maskRectangle.scaleX = 0;



                //Add the rectangle onto the container

                container.addChild(maskRectangle);



                //Add the mask rectangle to the rectangles array

                rectangles.push(maskRectangle);

        }

}



//Create and start a timer.

//This timer is called as many times as there are rectangles on the stage.

var timer = new Timer(35,rectangles.length);

timer.addEventListener(TimerEvent.TIMER, animateMask);

timer.start();



//This function is called every 0.035 seconds

function animateMask(e:Event):void {



        //Save the rectangle to a local variable

        var rectangle = rectangles[timer.currentCount - 1];



        //Tween the scaleX of the rectangle

        var scaleTween:Tween = new Tween(rectangle,"scaleX",Regular.easeOut,0,1,1,true);

        tweens.push(scaleTween);



}

11、完工,測試影片。

版權(quán)所有PS設(shè)計教程網(wǎng)公安備案:蘇公網(wǎng)安備 32058302001023號工信部備案:滬ICP備09005587號
aaa
主站蜘蛛池模板: 嫩呦国产一区二区三区av | 国产美女久久 | 亚洲日韩欧美一区二区在线 | 午夜免费视频 | 美女爽到呻吟久久久久 | 国产一区 | 亚洲aⅴ天堂av在线电影软件 | 久久成人综合网 | 国偷自产视频一区二区久 | 欧美日韩一区在线 | 久草免费在线 | 国产精品久久久久久久久免费丝袜 | 成人不卡| 黄色免费网站视频 | 亚洲第一区在线 | 日本色视频 | 成人精品在线观看 | 91亚洲精品乱码久久久久久蜜桃 | av在线精品 | 97av| 91国内精品| 一级片网 | 电影91 | 日本成人三级 | 狠狠躁日日躁夜夜躁东南亚 | 激情欧美一区二区三区中文字幕 | 日韩电影一区二区三区 | 午夜精品一区二区三区在线 | 中文字幕成人 | 欧美自拍视频 | 看免费的毛片 | 久操成人 | 武道仙尊动漫在线观看 | 极品美女av | 国产成人精品国内自产拍免费看 | 中文字幕亚洲电影 | 色综久久 | 欧美久久成人 | 日韩中文一区二区三区 | 一区二区日韩在线观看 | 99精品欧美一区二区三区综合在线 |