利用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. The very next time I read a blog, Hopefully it does not disappoint me as much as this particular one. After all, I know it was my choice to read through, however I really thought you would probably have something helpful to say. All I hear is a bunch of complaining about something that you can fix if you were not too busy looking for attention.

  2. why do people call Lebron James “King James”. Because Kings rule & have thrones, Lebron hasn’t even won a title, who is Lebron ruling over ?,IAmBobbyDrake,

  3. Whitescreen53表示:

    Very good post! We are linking to this particularly great post on our site. Keep up the great writing.

  4. I take pleasure in, lead to I found exactly what I was taking a look for. You have ended my four day long hunt! God Bless you man. Have a great day. Bye

  5. Hi there! This article could not be written much better! Looking at this post reminds me of my previous roommate! He always kept talking about this. I’ll forward this post to him. Pretty sure he will have a good read. Thank you for sharing!

  6. As a web site owner I believe the subject matter here is reallyexcellent. I appreciate it for your efforts. You should keep it up forever! Best of luck…

  7. great points altogether, you just received a new reader. What would you suggest about your publish that you just made some days ago? Any sure?

  8. Wdftfh表示:

    buy oxcarbazepine sale – levothyroxine brand purchase levoxyl sale

  9. Howdy, There’s no doubt that your site might be having web browser compatibility issues. When I look at your site in Safari, it looks fine but when opening in IE, it has some overlapping issues. I just wanted to give you a quick heads up! Other than that, great blog!

  10. I’m really inspired together with your writing abilities and also with the layout to your weblog. Is this a paid subject matter or did you customize it yourself? Either way keep up the excellent high quality writing, it is uncommon to see a nice weblog like this one nowadays..

  11. the doctor said that we have an allergic baby that is why we choose hypoallergenic baby clothes“

  12. shower leak表示:

    Splendid post. We learn brand new stuff upon various blogs daily. Couple of revitalizing to determine content material using their company writers as well as grow to be familiar having a little some thing their own certain. I’d believe to make use of a few inside the information on my blog need to don’t mind. Normally I’ll provides a link back up in internet internet site. Thanks sharing.

  13. web site表示:

    best youtube services watch hours instafollowers.

  14. Hello there, simply become aware of your weblog thru Google, and located that it is really informative. I’m going to be careful for brussels. I’ll be grateful when you continue this in future. Numerous people shall be benefited from your writing. Cheers!

  15. I observe there is plenty of spam on this weblog. Do you need assist cleaning them up? I might help among classes!

  16. CASINO5588表示:

    That is a great tip especially to those fresh to the blogosphere. Brief but very accurate info… Thanks for sharing this one. A must read article!

  17. Did I not mention that? Someone has put a hit on him, and he’s gonna find out who.

  18. The next time I learn a weblog, I hope that it doesnt disappoint me as much as this one. I mean, I do know it was my choice to read, but I actually thought youd have one thing fascinating to say. All I hear is a bunch of whining about something that you possibly can repair in case you werent too busy looking for attention.

  19. Wonderful blog post and certainly will help with becoming familiar with the subject better.

  20. You really make it show up really easy using your presentation however i locate this kind of issue being really something which I believe I might in no way realize. It appears as well intricate and extremely great personally. My partner and i’m taking a look in advance on your subsequent submit, We?|ll attempt to get the hang on to than it!

  21. Pjbkro表示:

    hytrin 1mg generic – dapoxetine where to buy priligy 60mg pills

  22. Hmm is anyone else having problems with the pictures on this blog loading? I’m trying to find out if its a problem on my end or if it’s the blog. Any feed-back would be greatly appreciated.

  23. Reent表示:

    What we do know is that you’ll be able to assemble your own mech and freely explore the environment, seemingly with slow, steady movements. According to the Japanese version of the trailer’s YouTube description, you’ll be able to utilize more dynamic movements, fire weapons and engage in close combat when you battle enemies. Inaccessibility is core to the FromSoftware experience, but excludes swaths of its potential audience because of it. Sekiro: Shadows Die Twice director Masaru Yamamura is helming the new Armored Core, and he tells IGN that the samurai action game and Armored Core 6 “share the same essence of battle such as aggressive, speed change and action-oriented fighting.” Players will break enemy mechs posture, he said, letting them strike with critical hits. Of course, I’m still very skeptical of the validity of these rumors and truly won’t be excited until FromSoftware officially confirms the existence of a new Armored Core themselves.
    https://data.openstate.eu/es_AR/user/pensgranapot1979
    Arts and fine arts programs typically best suit students who want to pursue the creative side of game design. A Bachelor of Fine Arts in game design program provides students with interactive media training that hones their skills in storytelling, visual design, animation, and other digital art aspects. Similarly, a Master of Fine Arts in game design program emphasizes artistic and creative elements but at a more advanced level. Students in these tracks often progress to careers as concept artists, game designers, and special effects artists. Game Designers attend college to learn the tools and skills necessary for getting hired by professional Game Design developer companies, such as EA Sports. Professional Game Design requires technical abilities. Even game design art majors learn how to use industry standard tools in digital animation.

  24. What would be your next topic next week on your blog.*:*’-

  25. there are professional career coaches out there that charges a small fee*

  26. Reent表示:

    Comparación de intercambios de criptomonedas populares. Elegir el mejor intercambio para un minero y comerciante Está disponible en un factor de forma full-ATX, y proporciona una sólida base de características para los usuarios, con funcionalidades como PCIe 4.0 y PCIe M.2 4.0. Su diseño de alimentación de 11 fases controlado por la tecnología DIGITAL PWM característica de BIOSTAR mantiene todo funcionando de forma suave y segura. Sus cuatro ranuras de RAM DDR4 que soportan hasta 3600(OC) con una capacidad máxima de 128GB hacen de esta placa una multiprropósito de calidad. Otras ocho ranuras PCIe 3.0×1, son ideales para la minería de BITCOIN y ETHEREUM, así como una única ranura PCIe 4.0 x16 ideal para poner cualquier tarjeta gráfica.
    https://rapid-wiki.win/index.php?title=Bitcoin_valor
    Podrás comprar criptomonedas en plataformas de intercambio, y cada una se especializa en diferentes criptos. Sigue estos consejos para saber dónde comprar criptomonedas: Podríamos destacar a Crypto como una de las mejores plataformas exchange de cifrado para farmear criptomonedas, con acceso total a cientos de mercados. En ella encontrarás todo tipo de monedas meme y además con bajas comisiones y la posibilidad de generar ingresos de forma pasiva. Aunque lo cierto es que no será mediante el método de agricultura de rendimiento. Admiral Markets AS Jordan Ltd está autorizada y regulada para llevar a cabo negocios de inversión por la Comisión de Valores de Jordania (JSC) en el Reino Hachemita de Jordania, número de registro 57026. El domicilio social de Admiral Markets AS Jordan Ltd es primera planta, Time Centre Building, Eritrea Street, Um Uthaina, Amman, Jordania.

  27. You can certainly see your skills within the work you write. The arena hopes for even more passionate writers such as you who aren’t afraid to mention how they believe. Always follow your heart.

  28. I just discovered your site! You’re amazing. Thank you for this!

  29. Cheap Kasper Suits… […]listed below are a couple of urls to internet websites we connect to for the fact we feel they really are really worth browsing[…]…

  30. Oh my goodness! a great write-up dude. Thank you However We are experiencing problem with ur rss . Do not know why Unable to join it. Could there be any person obtaining identical rss problem? Anybody who knows kindly respond. Thnkx

發佈留言

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