利用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 壓縮檔給各位,提供有興趣的同學參考。
There is certainly a lot to find out about this topic. I really like all of the points you made.
I would like to thank you for the efforts you have put in penning this website. I’m hoping to see the same high-grade blog posts by you in the future as well. In truth, your creative writing abilities has motivated me to get my very own site now 😉
atorlip price – lisinopril sale buy cheap bystolic
I’m impressed, I must say. Rarely do I encounter a blog that’s both equally educative and interesting, and without a doubt, you have hit the nail on the head. The problem is something that too few folks are speaking intelligently about. I am very happy that I stumbled across this during my search for something regarding this.
Very good info. Lucky me I recently found your site by accident (stumbleupon). I’ve book marked it for later!
Good write-up. I certainly appreciate this site. Keep it up!
After looking at a number of the blog articles on your web site, I honestly like your way of writing a blog. I saved it to my bookmark webpage list and will be checking back in the near future. Please check out my web site too and let me know what you think.
Great post! We are linking to this particularly great post on our site. Keep up the good writing.
I used to be able to find good info from your articles.
A fascinating discussion is definitely worth comment. I do think that you need to write more about this subject matter, it might not be a taboo matter but typically people do not speak about such issues. To the next! Cheers.
tenormin buy online – clopidogrel 75mg generic buy carvedilol 6.25mg
I blog often and I truly thank you for your information. The article has really peaked my interest. I am going to bookmark your blog and keep checking for new information about once a week. I opted in for your RSS feed too.
When I initially left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and now whenever a comment is added I recieve four emails with the same comment. There has to be a way you can remove me from that service? Thank you.
how to get verapamil without a prescription – order valsartan 80mg online cheap buy tenoretic generic
Aw, this was an incredibly good post. Finding the time and actual effort to produce a very good article… but what can I say… I hesitate a whole lot and don’t seem to get anything done.
Hello! I could have sworn I’ve been to this site before but after browsing through many of the articles I realized it’s new to me. Anyways, I’m definitely pleased I discovered it and I’ll be bookmarking it and checking back often.
Good web site you have got here.. It’s difficult to find high-quality writing like yours nowadays. I really appreciate people like you! Take care!!
Hi, I do believe this is an excellent blog. I stumbledupon it 😉 I will return yet again since i have saved as a favorite it. Money and freedom is the greatest way to change, may you be rich and continue to help others.
May I simply say what a relief to find a person that genuinely understands what they’re discussing on the internet. You certainly realize how to bring an issue to light and make it important. More and more people should check this out and understand this side of your story. I can’t believe you’re not more popular because you most certainly have the gift.
An outstanding share! I’ve just forwarded this onto a colleague who was conducting a little homework on this. And he actually ordered me breakfast simply because I stumbled upon it for him… lol. So let me reword this…. Thanks for the meal!! But yeah, thanks for spending time to discuss this topic here on your web page.
Very nice article. I definitely love this website. Thanks!
This is a topic which is close to my heart… Cheers! Exactly where are your contact details though?
I like what you guys are up also. Such smart work and reporting! Carry on the superb works guys I’ve incorporated you guys to my blogroll. I think it’ll improve the value of my web site .
Great write-up, I am normal visitor of one?s blog, maintain up the excellent operate, and It is going to be a regular visitor for a long time.
buy arava 20mg without prescription – order actonel generic where can i buy cartidin
Simplicity is an often-polarizing element in modern games, especially strategy games, that can be seen as a realm where complex system mastery is required of everything that wants to be a genre great. I think that’s a poison on the genre that pushes out perfectly enjoyable niches of game design, especially simple, accessible competitive multiplayer. This would be a fun game of tag to play in the fall since tagged players become scarecrows. A player must crawl through the scarecrow’s legs to free them. Become a wizard of typing with our collection of Typing Games. Go against the clock in Death by Spell Check, or fight off your enemies in Z-Type. No matter which game you choose, it will help your typing skills enormously. One of the most popular free-to-play PC games, like ever, Dota 2 is a top-down arena battler – aka a MOBA – that pays out serious cash to the best players. But it’s not only for obsessives or professionals. Instead, dive into the Steam Community forms, read some guides, talk to some players, and then rope in a few friends to help you get hooked on the original MOBA, and one of the biggest PC games in history – you’ll quickly see why it’s a perennial pick for our list of the best free games.
https://emilioaefh826159.blog-eye.com/26696728/free-girl-car-games
Rating Pending Front page layout Pursue your dream of an aviation career with Microsoft Flight Simulator 2024. The trailer teased this as the “next generation of flight simulation”. The new simulator will take full advantage of the latest technology in simulation. This includes cloud and machine learning, as it will be powered by a “significantly evolved Asobo Studio engine.” If you can’t wait to try out the game and want to know the Microsoft Flight Simulator 2024 release date, you’ve come to the right place. Here’s everything you need to know about the game. Microsoft has surprised the gaming world with the announcement of a new sequel to its acclaimed Microsoft Flight Simulator 2020. The new simulator, dubbed Microsoft Flight Simulator 2024 (FS2024), promises to take the simulation genre to the next level with cutting-edge technologies, stunning graphics and immersive gameplay.
As soon as I noticed this site I went on reddit to share some of the love with them.
I blog often and I truly thank you for your content. The article has really peaked my interest. I will take a note of your blog and keep checking for new details about once a week. I opted in for your RSS feed too.
I’m impressed, I must say. Rarely do I come across a blog that’s equally educative and interesting, and let me tell you, you have hit the nail on the head. The problem is something not enough men and women are speaking intelligently about. I’m very happy that I stumbled across this in my hunt for something regarding this.
You should be a part of a contest for one of the best sites online. I will recommend this website!