日本a在线观看_久久久三区_久久99精品久久久久久国产越南_在线观看中文字幕av_国产精品久久久久久久久久东京_a免费视频

PS設計教程網歡迎你!

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

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

這是一個遮罩動畫效果教程,學習用代碼制作遮罩動畫。

演示:

1、準備一張圖片。

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

3、導入圖片到庫中。

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

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

版權所有PS設計教程網公安備案:蘇公網安備 32058302001023號工信部備案:滬ICP備09005587號
aaa
主站蜘蛛池模板: 国产精品久久久久免费视频 | 国产亚洲综合一区二区 | 午夜小网站 | 色欲香天天天综合网站 | 国产成人精品免费视频大全最热 | 欧美色另类 | 末成年女av片一区二区 | 一级啪啪片 | 国产日韩a | av不卡免费观看 | 国产高清自拍一区 | 精品一区二区三区网站 | 新久草在线视频 | 欧美熟videos肥婆 | 午夜视频在线观看免费视频 | 国产99久久久久久免费看农村 | 日本一区二区高清不卡 | 色综合欧美 | 91av爱爱 | 亚洲欧美在线视频免费 | 精品一区二区三区免费毛片 | 怦然心动50免费完整版 | 曰本三级日本三级日本三级 | 国产成人综合在线观看 | 一级毛片真人免费播放视频 | 日本在线视频二区 | 精品国产一区二区三区在线观看 | 亚洲精品午夜国产va久久成人 | 久草在线新时代视觉 | 精品国产视频一区二区三区 | 午夜精品老牛av一区二区三区 | 欧美wwwwww| 欧美日韩亚洲在线 | 国产一级一区 | 国产91丝袜在线播放 | 久久国产成人午夜av浪潮 | 欧美18—19sex性护士中国 | 中文字幕在线观看成人 | 国产精品久久77777 | 色婷婷a v | 精品亚洲成a人在线观看 |