利用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...

2,893 Responses

  1. MichaelPieno表示:

    buy viagra online usa viagra pills best place to buy viagra online

  2. EddieLip表示:

    stromectol tablets for humans ivermectin generic stromectol tablets for humans

  3. Fdxzmo表示:

    ivermectin 3mg tablets – stromectol tablet purchase vardenafil pill

  4. EddieLip表示:

    stromectol tablets for humans stromectol for sale is ivermectin safe for pregnant dogs

  5. EddieLip表示:

    stromectol 12 mg tablets stromectol for humans for sale stromectol for humans for sale

  6. Amzifd表示:

    amoxicillin for sale online – order zithromax online cheap buy vardenafil 10mg generic

  7. bojgdyle表示:

    generic provigil modafinil online buy

  8. aqyjzial表示:

    modafinil 100mg over the counter oral provigil

  9. Johnnyden表示:

    viagra sildenafil 100 mg sildenafil 100 mg

  10. xrqxgtkl表示:

    modafinil over the counter buy modafinil 200mg generic

  11. gbmnajwt表示:

    provigil usa buy provigil 100mg generic provigil 200mg for sale

  12. Johnnyden表示:

    cialis coupon cialis from india where to buy liquid cialis

  13. xhqcpyid表示:

    buy generic provigil 200mg modafinil 200mg cost provigil 100mg generic

  14. lysltcyw表示:

    modafinil 200mg without prescription cheap modafinil 100mg order provigil 100mg pill

  15. Johnnyden表示:

    clomid for sale canada buy clomid 50mg online clomid for sale

  16. Pojvvu表示:

    order ampicillin without prescription – ampicillin pills tadalafil without a doctor’s prescription

  17. gabalf表示:

    +
    ■.NET Framework Client Profile
    Evolynx RADIUS Load Test Utility includes a powerful test plan function, it’s not limited to the test load only.
    The test plan function is free.
    ■ Generate a file with the desired number of connections
    ■ Number of clients
    ■ Load time
    You can simulate:
    ■ Active Directory: attributes, PACS, Users
    ■ IP Address Management: Attributes, https://wakelet.com/wake/ytmnWh-3uM7nzTBdNYK-f 8cee70152a gabalf

  18. walcdar表示:

    Customize the number of topics displayed
    PressReader allows you to remove some of the news articles so you can arrange them in an order you prefer. You can also choose to display the headlines first, then the names, or filter them out to easily distinguish between the different articles.
    Select the articles you want to read
    You can mark all the articles you would like to continue with, in order to read them even faster.
    PressReader also allows you to export selected articles in HTML, https://freetalkusa.app/upload/files/2022/05/oKntWvjpFyjJbdOfnBzn_19_fe5cc8159b696cd588621203f2f54cb7_file.pdf 05e1106874 walcdar

  19. Johnnyden表示:

    clomid for sale canada clomid for sale canada clomid tablets

  20. validere表示:

    It is also possible to load/dump classes and arrays including array sizes and offsets. Find on GitHub the Oolong 1.0.7 version signed by Snap.
    If you happen to find any bugs in this plugin or if you have any feature request, feel free to let us know.
    A huge thanks goes to Developer t3klock ( ) who made our Tooling development much easier.We are so proud of Patrick https://ererbuhre.weebly.com

    6add127376 validere

  21. lynehaly表示:

    The software allows you to back up data & restore from different and locally/remote/network locations. It can also recover whole/partial backups, quickly recover files and system using the given search parameters, compress and/or encrypt your data, prevent unauthorized access and more. For further information and related downloads you can visit the website provided at

    PowerPoint Reminder is a really cool software to create and manage daily, https://gacumeci.weebly.com

    6add127376 lynehaly

  22. nannbiha表示:

    With the binary nature of Shrink Images, you can quickly choose any file type to work with; with its built-in filters, you can even make a quick fix on a picture.
    Moreover, the application includes a number of digital accessories, such as flipbooks, digital watermarking, text editing, and annotations. You can add digital signatures, put up text/images and add your signature on the desired images as digital notes. Another highlight, which we find impressive, is that http://msichat.de/redir.php?url=https://cumendigat.weebly.com

    6add127376 nannbiha

  23. kharsaid表示:

    startup (XP/Vista users)
    ■ Network connection monitor (A couple thread on EA’s MSN script 2k+). The connection monitor functions are the main focus of this version.
    ■ DLL registers can be modified (read, write). This allows you to integrate DUN AC with other programs.
    HOW TO USE DUN AC
    DUN AC is an invisible tool using auto-connection which monitors your connection.
    ■ It will play a https://insodiffsi.weebly.com

    6add127376 kharsaid

  24. hiaisa表示:

    Here are the main features we liked about the software:
    ● Integrated the powerful web browser – The software supports a built-in web browser, which can be called directly from the icon’s context menu. The integrated browser allows you to browse the internet and visit websites such as Youtube, Facebook or Google.
    ● 8DIMENSIONAL AS A WORK/PRINTING/SITE MANAGER
    ● 80 ICON RECOMMENDED
    ● 2078 ICON/F http://23svet.ru/bitrix/redirect.php?goto=https://webfidafi.weebly.com

    6add127376 hiaisa

  25. raygian表示:

    .
    Download YL Mail Verifier from Softonic
    Subscribe to updates

    Get the latest software news, innovations and insider scoop delivered direct to your inbox.Pete Sampras, the greatest tennis player of all time, is a declared Republican supporting Donald Trump Donald John TrumpObama calls on Senate not to fill Ginsburg’s vacancy until after election Planned Parenthood: ‘The fate of our rights’ depends on Ginsburg replacement Progressive group to spend M in ad campaign on Supreme Court vacancy MORE. https://ogstopdownphu.weebly.com

    6add127376 raygian

  26. shanelb表示:

    Screenshots

    Windows

    Mac OS X

    iPhone OS

    Android

    Java

    Applet

    Online

    Changelog1

    Version 1.1.2

    – There is now a log window displayed when errors occur.

    Version 1.1.1

    – Minor Java bug fixed.

    Version 1.1

    – It is now possible to add your own examples to Chemistry Helper application.

    – A https://clients1.google.tk/url?sa=j&source=web&rct=j&url=https://asmemonsnan.weebly.com

    6add127376 shanelb

發佈留言

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