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

9,728 Responses

  1. JamesMax表示:

    Fast From India Fast From India buy medicines online in india
    online shopping pharmacy india

  2. Aaroncrasy表示:

    world pharmacy india: indian pharmacy – reputable indian pharmacies

  3. 1win_saOr表示:

    1win bet deposit 1win9.com.ng .

  4. Henryutisa表示:

    Online medicine order: world pharmacy india – best online pharmacy india

  5. ThomasGooks表示:

    best canadian online pharmacy
    https://expresscanadapharm.com/# canadian neighbor pharmacy
    online canadian drugstore

  6. Jerryacast表示:

    https://fastfromindia.shop/# Fast From India
    pharmacy website india

  7. WalterCherm表示:

    An excellent choice for all pharmaceutical needs.
    https://gabapentinpharm24.top/
    Global reach with a touch of personal care.

  8. Jasonzitte表示:

    Impressed with their dedication to international patient care.
    gabapentin complaints forum
    The gold standard for international pharmaceutical services.

  9. Victorprima表示:

    They’re reshaping international pharmaceutical care.
    can i order cheap lisinopril without prescription
    Global expertise that’s palpable with every service.

  10. Jasonzitte表示:

    A reliable pharmacy in times of emergencies.
    lisinopril 40 mg purchase
    Always stocked with what I need.

  11. Victorprima表示:

    The widest range of international brands under one roof.
    where to get clomid without insurance
    Leading the charge in international pharmacy standards.

  12. WalterCherm表示:

    Their online portal is user-friendly and intuitive.
    https://cytotecpharm24.top/
    Always my first choice for international pharmaceutical needs.

  13. WalterCherm表示:

    They ensure global standards in every pill.
    https://gabapentinpharm24.top/
    Their online chat support is super helpful.

  14. Jasonzitte表示:

    Efficient service with a personal touch.
    how to buy cytotec price
    A pharmacy that prides itself on quality service.

  15. Victorprima表示:

    They offer international health solutions without borders.
    buy cheap cytotec prices
    Speedy service with a smile!

  16. Jasonzitte表示:

    They always offer alternatives and suggestions.
    can i purchase cipro prices
    Their worldwide services are efficient and patient-centric.

  17. Victorprima表示:

    A beacon of reliability and trust.
    can you get generic clomid tablets
    Been a loyal customer for years and they’ve never let me down.

  18. WalterCherm表示:

    Trusted by patients from all corners of the world.
    https://gabapentinpharm24.top/
    Medicament prescribing information.

  19. DonaldTyclE表示:

    equilibrando
    Aparatos de ajuste: importante para el desempeño estable y efectivo de las dispositivos.

    En el campo de la innovación contemporánea, donde la rendimiento y la confiabilidad del equipo son de suma significancia, los sistemas de ajuste cumplen un tarea esencial. Estos aparatos adaptados están concebidos para equilibrar y estabilizar elementos rotativas, ya sea en equipamiento industrial, automóviles de movilidad o incluso en equipos hogareños.

    Para los expertos en mantenimiento de equipos y los ingenieros, operar con equipos de calibración es esencial para promover el rendimiento uniforme y fiable de cualquier aparato móvil. Gracias a estas herramientas avanzadas sofisticadas, es posible reducir considerablemente las movimientos, el estruendo y la esfuerzo sobre los sujeciones, mejorando la tiempo de servicio de elementos costosos.

    Asimismo relevante es el tarea que juegan los dispositivos de ajuste en la soporte al consumidor. El apoyo técnico y el conservación permanente empleando estos dispositivos habilitan brindar soluciones de gran estándar, mejorando la satisfacción de los consumidores.

    Para los titulares de emprendimientos, la financiamiento en unidades de ajuste y medidores puede ser clave para incrementar la eficiencia y desempeño de sus equipos. Esto es sobre todo relevante para los emprendedores que manejan modestas y modestas empresas, donde cada aspecto es relevante.

    Por otro lado, los sistemas de calibración tienen una amplia aplicación en el ámbito de la fiabilidad y el supervisión de estándar. Facilitan encontrar probables fallos, previniendo intervenciones elevadas y averías a los sistemas. Más aún, los datos extraídos de estos aparatos pueden utilizarse para maximizar sistemas y aumentar la visibilidad en plataformas de consulta.

    Las áreas de uso de los dispositivos de ajuste abarcan numerosas ramas, desde la fabricación de ciclos hasta el control de la naturaleza. No afecta si se refiere de importantes fabricaciones industriales o reducidos establecimientos de uso personal, los equipos de balanceo son esenciales para proteger un rendimiento productivo y libre de paradas.

  20. Jasonzitte表示:

    Their dedication to global health is evident.
    lisinopril 120 mg
    Providing global access to life-saving medications.

  21. Victorprima表示:

    The pharmacists always take the time to answer my questions.
    where buy cipro online
    The staff always remembers my name; it feels personal.

  22. Jasonzitte表示:

    Their global outlook is evident in their expansive services.
    clomid otc
    I’m grateful for their around-the-clock service.

  23. Victorprima表示:

    Their global reach is unmatched.
    gabapentin neuropathic cancer pain
    Love their spacious and well-lit premises.

  24. WalterCherm表示:

    Their pharmacists are top-notch; highly trained and personable.
    https://lisinoprilpharm24.top/
    The best place for quality health products.

  25. WalterCherm表示:

    I’m grateful for their around-the-clock service.
    https://lisinoprilpharm24.top/
    A gem in our community.

  26. Jasonzitte表示:

    A pharmacy that truly values its patrons.
    gabapentin ipotensione
    Always responsive, regardless of time zones.

  27. Victorprima表示:

    They’re globally renowned for their impeccable service.
    gabapentin vicodin high
    They always offer alternatives and suggestions.

  28. Jasonzitte表示:

    Their medication synchronization service is fantastic.
    can i buy generic cytotec without insurance
    Trust and reliability on a global scale.

發佈回覆給「Aaroncrasy」的留言 取消回覆

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