利用Tweener製作動畫 – 其他參數

因為這陣子馬老師擔任了崇右數位媒體設計系的系主任後業務繁忙,好久沒在部落格上貼文章了,現在總算有些空檔可以繼續貼文,之前寫了有關利用Tweener製作動畫的文章,接著這篇文章來介紹在Tweener中其他可用的參數,請各位參考,不過詳細的部分還是可以參考官網的說明。


delay:可以設定在動畫完成後多久,再接續進行下一動畫(Tweener delay 範例

import caurina.transitions.Tweener

Tweener.addTween(ball, {x:150, time:1});
//用一秒鐘的時間移動ball元件至x為150的位置
Tweener.addTween(ball, {y:100, time:1, delay: 2});
//等待兩秒後用一秒鐘的時間移動ball元件至y為100的位置

getTweenCount:取得目前動畫的補間數量(Tweener getTweenCount 範例

import caurina.transitions.Tweener

Tweener.addTween(ball, {x:150, time:2});
Tweener.addTween(ball, {y:100, time:2,delay:2});
txt.text="元件Ball共有" + Tweener.getTweenCount(ball) + "段補間動畫"

getTweens:取得目前動畫所更改元件的屬性(Tweener getTweens 範例

import caurina.transitions.Tweener

Tweener.addTween(ball, {x:150, y:100, alpha:1, time:2});
txt.text="元件Ball共被製作了" + Tweener.getTweens(ball) + "的屬性變化"
//輸出元件被補間的屬性

getVersion:取得目前使用Tweener的版本(Tweener getVersion 範例

import caurina.transitions.Tweener

Tweener.addTween(ball, {x:150, y:100, time:2});
txt.text="本動畫使用Tweener版本為:" +Tweener.getVersion()
//輸出元件使用Tweener的版本

onStart、onUpdate、onComplete:分別在補間「開始」、「進行中」、「結束」呼叫不同的函數執行(Tweener complex 範例

import caurina.transitions.Tweener
import flash.events.MouseEvent;

Tweener.addTween(ball, {x:150, y:100, time:3,onStart:startFn,onUpdate:updateFn,onComplete:completeFn});
/*用三秒鐘的時間移動ball元件至x為150和y為100的位置
開始時執行startFn函數
過程中執行updateFn函數
完成後執行completeFn函數
*/
function startFn(){
	ball.alpha=0.1
}

function updateFn(){
	ball.alpha+=0.02
	txt.text="球體正在移動"
}

function completeFn(){
	ball.alpha=1
	txt.text="現在可以拖曳球體"
	ball.addEventListener(MouseEvent.MOUSE_DOWN,downFn)
	ball.addEventListener(MouseEvent.MOUSE_UP,upFn)
	function downFn(e:MouseEvent){
		ball.startDrag()
	}
	function upFn(e:MouseEvent){
		ball.stopDrag()
	}
}

addCaller:在指定的時間內呼叫某函數N次(Tweener addCaller 範例

import caurina.transitions.Tweener
var i=0
no.text=i
Tweener.addCaller(no, {onUpdate:go, time:10, count:10 , transition:"linear"});
//在10秒內針對no執行10次go函數
//Tweener.addCaller(no, {onUpdate:go, time:10, count:10 , transition:"easeinquad"});
//在10秒內針對no執行10次go函數且速度越來越慢

function go(){
	i++
	no.text=i
}

controlTweens:控制由Tweener所產生的動畫(Tweener controlTweens 範例

import caurina.transitions.Tweener

Tweener.addTween(ball, {x:280, time:20,transition:"linear"});

pauseBtn.addEventListener(MouseEvent.CLICK,pauseFn)
resumeBtn.addEventListener(MouseEvent.CLICK,resumeFn)

function pauseFn(e:MouseEvent){
	pauseBtn.visible=false
	resumeBtn.visible=true
	Tweener.pauseAllTweens(); 
}

function resumeFn(e:MouseEvent){
	pauseBtn.visible=true
	resumeBtn.visible=false
	Tweener.resumeAllTweens(); 
}

soundVolume:利用Tweener來控制音量(Tweener soundVolume 範例

import caurina.transitions.Tweener;
import caurina.transitions.properties.SoundShortcuts;
SoundShortcuts.init();

var snd:Sound = new heavy  ;
var chn:SoundChannel = new SoundChannel  ;
chn = snd.play(0,1000);

btn.addEventListener(MouseEvent.CLICK,clickFn)

function clickFn(e:MouseEvent){
	Tweener.addTween(chn, {_sound_volume:0, time:10});
}
//點選按鈕後聲音會在十秒內逐漸歸零

FilterShortcut:Tweener也可以控制Flash中的各種濾鏡,利用濾鏡來製作動畫或互動(blurFilter 範例dropShadowFilter 範例

blurFilter –

import flash.filters.*; 
import caurina.transitions.properties.FilterShortcuts;
import caurina.transitions.Tweener
FilterShortcuts.init();

var blur:BlurFilter=new BlurFilter

stage.addEventListener(MouseEvent.CLICK,clickFn)
function clickFn(e:MouseEvent){
	Tweener.addTween(ball, {time:0,_Blur_blurX:20,_Blur_blurY:20});
	Tweener.addTween(ball, {x:mouseX, y:mouseY, time:2,_Blur_blurX:0,_Blur_blurY:0, transition:"easeOutQuart"});
}

dropShadowFilter –

import caurina.transitions.properties.FilterShortcuts;
import caurina.transitions.Tweener
import roMc

FilterShortcuts.init();
stage.addEventListener(Event.ENTER_FRAME,shadowFn)
function shadowFn(e:Event){
	Tweener.addTween(ball, {time:0,_DropShadow_angle:roMc.ro(ball)+180,_DropShadow_distance:6});
}

以上是有關Tweener參數的一些範例,這邊也把Tweener Parameters 壓縮檔給各位,提供有興趣的同學參考。

You may also like...

3,316 Responses

  1. Thank you for all the information was very accurate, just wondering if all this is possible.~

  2. Thank you for the auspicious writeup.

  3. rab表示:

    You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page. Copyright © Center for the Study of Services. All Rights Reserved. Featured Stores The company sponsors the NASCAR “30-lap Stanley Steemer NASCAR Late Model” race held at Rockford Speedway in Rockford, Illinois. 7:30am – 6:00pm Download The National Air Duct Cleaners Association (NADCA) advises cleaning air ducts every 3 to 5 years. Other HVAC pros suggest cleaning every 5 to 7 years with well-sealed ducts. Cleaning frequency depends on duct conditions, climate, system usage, number of residents, and if people have respiratory issues. Indoor air quality is a primary concern among homeowners throughout West Palm Beach and ALL OF SOUTH FLORIDA. The air inside a typical home contains everything from dirt and dust mites to bacteria, mold and fungus, and the subtropical humidity intensifies their presence. When air ducts are not cleaned regularly, your HVAC system recycles these impurities. This poor air quality contributes to allergies and illnesses. https://blogif.in/community/profile/kennethcouch06/ Among the Industrial Cleaning Services we offer are Hydroblasting, Boiler Fireside Cleaning, Recovery Boiler Smelt Bed Removal,Vacuum Trucks, Sweeping, Tank Cleaning, Hydro Excavating, Stormwater Maintenance, and Pressure Washing; Emergency Spill Response, Remediation, Decontamination, UST and other Environmental services; Hazardous and Non-Hazardous Waste Transportation and Disposal; all of which contribute to being able to offer simplified support sourcing for our customers with a comprehensive package of services from a primary source. At All-GreenJanitorialProducts.com you will find an impressive selection of environmentally friendly cleaning products that are absolutely fabulous. You may worry that environmentally safe cleaning products aren’t nearly as effective as the more conventional cleaning products that you would usually buy. The good news is that eco friendly cleaning products are just as effective, if not more so, than your usual brand of cleaning product.

  4. Adrianmiz表示:

    paxil 10 mg paxil er

  5. ThomasUnogs表示:

    https://azithromycin.blog/# zithromax over the counter canada

  6. Joannpisn表示:

    dating sex
    european dating site uk
    totally free dating on facebook

  7. leer mas表示:

    I appreciate your work, thanks for all the great blog posts.

  8. Gladipisn表示:

    gay internet dating
    scruff gay dating app
    gay dating websites dallas

  9. Tommyhon表示:

    https://finasteride.top/# finasteride 5 mg prices

  10. It’s continually awesome when you can not only be informed, but also entertained! I’m sure you had fun writing this article. Regards, Clotilde.

  11. A good web site with interesting content, that’s what I need. Thank you for making this web site, and I will be visiting again. Do you do newsletters? I Can’t find it.

  12. ThomasUnogs表示:

    https://paxil.tech/# 20 mg paxil

  13. DavidSquaw表示:

    https://glucophage.top/# buy metformin

  14. Such an amazing blog! Very informative!

  15. Adrianmiz表示:

    paxil cr paxil for ocd

  16. Fuoetk表示:

    purchase isosorbide online cheap atenolol 100mg ca order atenolol 100mg sale

  17. uttehal表示:

    purchase stromectol online isotretinoin acutane pills no physician approval overseas

  18. Unewbb表示:

    order azulfidine online cheap buy sulfasalazine 500mg generic buy generic divalproex 500mg

  19. Tommyhon表示:

    https://paxil.tech/# drug paxil

  20. ThomasUnogs表示:

    https://azithromycin.blog/# average cost of generic zithromax

  21. Hi, I just hopped over to your web-site through StumbleUpon. Not somthing I might typically browse, but I liked your views none the less. Thanks for making something worthy of reading through.

  22. Faswbj表示:

    minocycline 100mg ca hytrin 1mg pills order leflunomide without prescription

  23. Deshawntix表示:

    can you buy wellbutrin online 750 mg wellbutrin

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。