利用Tweener製作動畫 – 廣告看板

依然是Tweener範例清倉,本篇範例大致是搭配Tweener讓目標物移動到指定座標的效果,話不多說看範例吧!

Tweener 橫幅廣告 範例:主要為利用Tweener針對廣告看板進行移動,以下為本範例的程式碼:

import caurina.transitions.Tweener;
var i:int;//迴圈用變數
var pic:int = 1;//播放張數紀錄變數
var clock;//計時器變數

//按鈕變色與監聽
btnChange();
function btnChange()
{
	for (i=1; i<=4; i++)
	{
		this["b" + i].gotoAndStop(1);
		this["b" + pic].gotoAndStop(2);
	}
}
for (i=1; i<=4; i++)
{
	this["b" + i].addEventListener(MouseEvent.CLICK,clickFn);
}
function clickFn(e:MouseEvent)
{
	clearInterval(clock);
	clock = setInterval(autoChange,5000);
	pic = e.currentTarget.name.substr(1,1);
	bannerChange();
	btnChange();
}

//計時器設定(每5秒更換)
clock = setInterval(autoChange,5000);
function autoChange()
{
	pic++;
	if (pic>4)
	{
		pic = 1;
	}
	bannerChange();
	btnChange();
}
//圖片切換函數
function bannerChange()
{
	Tweener.addTween(banner, {x:(pic-1)*-560, time:1, transition:"easeOutQuint"});
}

橫幅廣告 範例 原始檔 下載


Tweener 移動看板 範例:與上面範例大致相同,不過本範例增加了縱向的移動。

import caurina.transitions.Tweener
var i
var j
var targetX
var targetY

for(i=1;i<=3;i++){
	for(j=1;j<=3;j++){
		this["b"+i+j].addEventListener(MouseEvent.CLICK,moveFn)
	}
}
function moveFn(e:MouseEvent){
	targetX=(e.currentTarget.name.substr(2,1)-1)*-450
	targetY=(e.currentTarget.name.substr(1,1)-1)*-450
	Tweener.addTween(nb, {x:targetX, y:targetY, time:2, transition:"easeOutQuint"});
}

移動看板 範例 原始檔 下載

You may also like...

830 Responses

  1. Uoszjy表示:

    order generic lasix order furosemide 40mg generic where to buy furosemide without a prescription

  2. Iihpxk表示:

    purchase serophene online clomiphene 50mg for sale clomiphene 50mg for sale

  3. Robertmab表示:

    Thanks for the complete information. You helped me.

  4. Hucbbp表示:

    purchase gabapentin pills cost neurontin 600mg neurontin 100mg generic

  5. Dgpkmc表示:

    purchase levothyroxine for sale cost synthroid buy levothyroxine without prescription

  6. Iehsjk表示:

    buy omnacortil medication buy cheap generic prednisolone prednisolone 10mg generic

  7. Icbpou表示:

    amoxiclav cheap cheap augmentin 1000mg order augmentin

  8. Amura表示:

    Thanks for the complete information. You helped me.

  9. Ejuvuy表示:

    purchase azithromycin generic order generic zithromax purchase azithromycin generic

  10. Ksjamk表示:

    order ventolin inhalator without prescription order ventolin 4mg generic order albuterol 2mg sale

  11. Lgvbhv表示:

    order generic amoxicillin 500mg amoxicillin online buy amoxicillin brand

  12. Uqmkkn表示:

    order rybelsus online rybelsus 14mg cheap buy rybelsus cheap

  13. Zvtuku表示:

    isotretinoin 40mg drug purchase accutane for sale purchase isotretinoin online cheap

  14. Farpai表示:

    buy semaglutide 14mg without prescription rybelsus 14mg cheap how to get rybelsus without a prescription

  15. Jdbwum表示:

    buy deltasone 10mg generic order generic deltasone 20mg deltasone 5mg drug

  16. Puegwj表示:

    buy clomid 100mg generic order clomiphene 100mg online cheap generic clomiphene 100mg

  17. Cegubb表示:

    cheap tizanidine 2mg brand tizanidine tizanidine 2mg over the counter

  18. Ckramq表示:

    buy generic vardenafil for sale buy generic vardenafil

  19. Yuazkz表示:

    synthroid for sale online cheap levoxyl online order synthroid 100mcg online

  20. Zbaiel表示:

    augmentin online buy augmentin cost

  21. Tdsztm表示:

    purchase albuterol online order albuterol pill generic allergy pills

  22. Nefqyy表示:

    order generic doxycycline monodox pills

  23. Xnmcxu表示:

    amoxicillin 250mg generic buy amoxicillin 1000mg pills order amoxil 500mg sale

  24. Pspbnr表示:

    buy omnacortil paypal omnacortil 20mg us omnacortil 10mg cheap

  25. Qpwcar表示:

    furosemide 40mg price cheap lasix 40mg

  26. Udfgcp表示:

    azipro 250mg sale buy azithromycin 500mg generic azithromycin 500mg generic

  27. Jnoldv表示:

    gabapentin 600mg for sale order neurontin 600mg

  28. Chdebp表示:

    zithromax 250mg drug order azithromycin 250mg generic zithromax drug

  29. Cmxknh表示:

    strongest sleeping pills at walgreens buy melatonin 3mg sale

發佈留言

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