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

769 Responses

  1. 카지노表示:

    This is really interesting, You’re a very skilled blogger. I have joined your feed and look forward to seeking more of your great post. Also, I’ve shared your web site in my social networks!

  2. Some truly interesting info , well written and broadly user genial .

  3. You ma’am have a way with words. Thank you very much!

  4. A neighbor of mine encouraged me to take a look at your blog site couple weeks ago, given that we both love similar stuff and I will need to say I am quite impressed.

  5. I wish I could craft such articles as this. Thank you very much.

  6. SABAKAWLBIXlz表示:

    can i get pregabalin without a prescription can you get pregabalin where to buy cheap pregabalin without a prescription

  7. SABAKAWLBIXgh表示:

    can i purchase pregabalin how to get pregabalin cost of pregabalin without a prescription

  8. I am glad to be a visitor of this perfect blog !, appreciate it for this rare info!

  9. Oh my goodness! an amazing article. Great work.

  10. I’ve been surfing online more than 3 hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. In my view, if all web owners and bloggers made good content as you did, the net will be much more useful than ever before.

  11. Very often I go to see this blog. It very much is pleasant to me. Thanks the author

  12. OABAKAWLBIXlp表示:

    pregabalin 75 mg ca how to get pregabalin without dr prescription how to buy generic pregabalin prices

  13. It’s continually awesome when you can not only be informed, but also entertained! I’m sure you had fun writing this article. Regards, Clotilde.

  14. totosite表示:

    I am very impressed with your writing totosite I couldn’t think of this, but it’s amazing! I wrote several posts similar to this one, but please come and see!

  1. 2022-10-20

    write my paper reviews https://term-paper-help.org/

  2. 2022-10-21
  3. 2022-10-21

    buy cheap paper online https://uktermpaperwriters.com/

  4. 2022-10-21

    paper writer services https://write-my-paper-for-me.org/

  5. 2022-10-21

    buy papers online for college https://doyourpapersonline.com/

  6. 2022-10-21

    buy papers for college online https://top100custompapernapkins.com/

  7. 2022-10-21
  8. 2022-10-21

    order custom paper https://cheapcustompaper.org/

  9. 2022-10-21

    do my paper for money https://writingpaperservice.net/

  10. 2022-10-21

    help writing papers https://mypaperwritinghelp.com/

  11. 2022-10-21
  12. 2022-10-21

    what should i write my paper on https://essaybuypaper.com/

  13. 2022-10-21

    pay for someone to write your paper https://papercranewritingservices.com/

  14. 2022-10-21

    help with filing divorce papers https://premiumpapershelp.com/

  15. 2022-10-21

發佈留言

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