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

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
主站蜘蛛池模板: 视频一区二区三区中文字幕 | 日韩成人在线播放 | 一本色道久久综合狠狠躁的推荐 | 97香蕉久久国产超碰青草软件 | 在线一级视频 | 久久久久久久国产 | 韩日黄色片 | 精品无码久久久久国产 | 亚洲欧美国产毛片在线 | 中文字幕一区二区三区精彩视频 | 成人免费在线观看 | 久久丁香 | 国色天香成人网 | 久久久久久久久综合 | 中文字幕在线视频免费观看 | 亚洲成色www久久网站瘦与人 | 国产精品99久久久久 | 在线观看成人 | 欧美亚洲一区二区三区 | 久久久免费 | 日韩欧美综合 | 欧美午夜一区二区三区免费大片 | 日本1区2区| 一级a性色生活片久久毛片明星 | 狠狠色综合欧美激情 | 欧美性生活视频 | 得得啪在线视频 | 自拍偷拍第一页 | 亚洲欧美一区二区三区国产精品 | 黄色免费高清视频 | 久久成人精品一区二区三区 | 日韩久久久久久久久久 | 国产成人片 | 国产色播 | 色婷综合 | 日韩精品一区二区三区在线观看 | 在线成人免费视频 | 国产欧美日韩一区二区三区 | 综合久久一区 | 日韩性猛交 | 国产视频精品久久 |