利用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,932 Responses

  1. You should be a part of a contest for one of the best websites on the net. I’m going to recommend this web site!

  2. I was wondering if you ever considered changing the structure of your site? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having one or two images. Maybe you could space it out better?

  3. porn表示:

    Hi, I do believe this is a great web site. I stumbledupon it 😉 I’m going to return once again since i have book-marked it. Money and freedom is the best way to change, may you be rich and continue to help other people.

  4. Ydhjro表示:

    rogaine where to buy – buy generic dutas for sale finpecia ca

  5. quotes表示:

    An impressive share! I’ve just forwarded this onto a co-worker who was doing a little research on this. And he actually ordered me lunch simply because I found it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanx for spending some time to talk about this topic here on your blog.

  6. Fab表示:

    You need at least three scatters to trigger the free spins round, and up to 100 free spins are up for grabs. The number of free spins that you win will depend on the number of free spin symbols that appear on the board. To begin, we’ll bring it down to you this early: We’ve got over 500 games in Go Wild Online Casino. Encrypted with 128-bit technology, eCOGRA approved—all our games are safe, fair, and accurate. And of course, we guarantee hours and hours of GoWild fun! You can take advantage of the GoWild casino no deposit bonus or even the Go Wild Casino free spins. It’s all waiting for you here.   250% Match Bonus up to $2,500 + 50 Free Spins Whether it’s a welcome bonus, free spins, Wild Casino no deposit bonus codes 2022, or the day’s special offer, you’ll find that Go Wild Casino does not disappoint! Read on to find out more about the latest offers and how to claim your favorite one!
    https://charlie-wiki.win/index.php?title=Latest_news_internet_casinos_bangladesh
    Ozwin casino has acknowledged that players absolutely love the possibility to spin a cheeky pokie on the go. Therefore, Ozwin is available to play on mobile, PC and tablet browser! Our team at CasinoAlpha rated this $10 no deposit bonus as highly recommended for the high number of 100 free spins awarded on the Bigger Cash Win game. If you’re a classic slot fan, 100 free spins offer plenty of gameplay value. The 45x wagering requirement is above the standard of 35x, but the $100 max cashout makes this a great offer that requires no initial investment. This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.

  7. I could not refrain from commenting. Perfectly written!

  8. Rmifvz表示:

    where can i buy durex gel – purchase durex condoms sale latanoprost online buy

  9. Thank you for your thought-provoking post.검색엔진최적화 업체

  10. Sfpykp表示:

    order ascorbic acid generic – where can i buy lopinavir ritonavir how to buy compro

  11. This is a must-read for anyone interested in…소상공인 대출

  12. Ebiiem表示:

    purchase ondansetron pill – purchase detrol generic order requip 2mg

  13. Your passion for this topic is evident.비상금 대출

  14. Yahwqn表示:

    order flexeril generic – enalapril 10mg cheap order enalapril online

  15. nob表示:

    Playboy is Microgaming’s hottest slot! It is a 5 reels slot with 4 sexy Playboy bunnies. Jackpots in the best Microgaming slot machine games are mostly progressive (approximately 10%). The crown jewel is the Mega Moolah, known for record-breaking progressive jackpot wins. It has consistently offered life-changing prizes, with the highest payout in history exceeding $20 million. Progressives hold several advantages: the opportunity to win enormous sums of money, create excitement, and provide engaging themed gameplay. These are popular among online gamblers because of their massive jackpot potential. Here’s a table showcasing a list of Microgaming progressive slots: There really are so many brilliant Microgaming slots available to play and you may even recognise some of the different mobile slots mentioned above as they’ve been big hits in the online slot world.
    https://models.yclas.com/user/dreamniacritos1981
    Currently, there is not a PokerStars PA no-deposit bonus available, although PokerStars does sometimes offer these to new and existing customers. Both of the bonuses mentioned above require only a $10 deposit to trigger them. There are two bonuses for new PokerStars PA players to claim, one is a free package of tickets, casino cash, and free spins worth $100, the other is a 100% match up to $600 first deposit bonus; the latter requires a PokerStars PA bonus code. PokerStars PA often runs promotions where it awards PokerStars PA free tickets instead of a PokerStars PA free bonus. These types of bonuses usually appear during major poker tournament festivals, and offer players free tournament tickets. PokerStars is a legal and licensed online poker room. Here in the United States, it offers a wide variety of poker games. Worldwide, PokerStars is known as the world’s top online poker room. In fact, PokerStars is known for its award-winning software.

  16. Kvpfiq表示:

    cyclophosphamide buy online – purchase strattera without prescription buy trimetazidine generic

  17. Utydzl表示:

    aldactone oral – buy aldactone for sale naltrexone cheap

  18. Yhdyaa表示:

    oral disopyramide phosphate – cheap disopyramide phosphate generic order chlorpromazine 100mg without prescription

  19. Sibyl Kusick表示:

    토토 에볼루션

  20. Tonic Greens表示:

    you’re truly a excellent webmaster. The site loading velocity is amazing. It seems that you’re doing any distinctive trick. In addition, The contents are masterwork. you’ve performed a magnificent activity in this subject!

  21. Hiya! awesome blog! I happen to be a daily visitor to your site (somewhat more like addict ) of this website. Just wanted to say I appreciate your blogs and am looking forward for more to come!

  22. Lpmhsd表示:

    divalproex 500mg ca – buy aggrenox medication order topamax 200mg pills

  23. The color of your blog is quite great. i would love to have those colors too on my blog.*’.*’

  24. you got a very excellent website, Sword lily I found it through yahoo.

  25. Superior blog! I truly love how it is simple on my eyes and the information are well written. I’m wondering how I could be notified whenever a new post has become made. I have subscribed to your RSS which must do the trick! Have an excellent day!

  26. An impressive share, I recently given this onto a colleague who was doing a small analysis with this. And the man actually bought me breakfast because I came across it for him.. smile. So let me reword that: Thnx for any treat! But yeah Thnkx for spending time to go over this, I’m strongly concerning this and really like reading more about this topic. If you can, as you grow expertise, could you mind updating your blog site with an increase of details? It is actually highly useful for me. Large thumb up for this text!

  27. I am curious to find out what blog system you’re working with? I’m having some minor security issues with my latest site and I would like to find something more safe. Do you have any suggestions?

  28. I don’t make it a habit to make comments on many articles, but this one deserves attention. I agree with the data you have written so eloquently here. Thank you.

  29. i use both gold and silver bracelets because for me, they are both great bracelets to wear;;

發佈留言

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