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

15,349 Responses

  1. вывод из запоя в стационаре анонимно вывод из запоя в стационаре анонимно .

  2. вывод из запоя круглосуточно сочи вывод из запоя круглосуточно сочи .

  3. как сделать загранпаспорт быстро как сделать загранпаспорт быстро .

  4. lagjo46表示:

    special info pop over here 3919011

  5. какой процессор лучше topcpu.ru .

  6. qqevx575表示:

    you can look here go to the website 612188

  7. Learn The ADHD Symptoms In Women Tricks The Celebs Are Using adhd adult female Symptoms [jamesnerve7.Werite.Net]

  8. сравнение производительности процессоров https://topcpu.ru .

  9. cnuoj574表示:

    look at this now their website 4063085

  10. Kathy Kuniyoshi表示:

    Magparehistro sa https://vip-slot.com – vip slot at tanggapin ang espesyal na welcome bonus na $100! Ito ay isang regalo para sa mga bagong user na nais maranasan ang saya ng online casino gaming. Gamitin ang bonus para subukan ang mga sikat na laro at manalo nang higit pa. Madaling mag-sign up, kaya’t simulan na ang iyong journey ngayon!

  11. JacobLoody表示:

    nedra2021.ru/ — индивидуальный проект под любой запрос.

  12. sex porn表示:

    Pretty! This was an incredibly wonderful article. Many thanks for supplying this information.

  13. Clair Merrett表示:

    Simulan ang iyong https://gemini-ph.com – gemini journey nang may libreng $100! Magparehistro bilang bagong user at makuha ang espesyal na bonus para sa mga laro tulad ng baccarat, slots, at live casino. Ang simpleng registration process ay nagbibigay sa iyo ng dagdag na advantage. Sumali na ngayon!

  14. Tim Larsh表示:

    Makakuha ng Bonus na $100 Sa Unang Pagparehistro sa https://eclipse-ph.com – eclipse!

  15. https://www.tellern.com Telegram应用是开源的,Telegram下载的程序支持可重现的构建。Telegram同时适用于以下环境:Android安卓端,iPhone 和 iPad及MacOS的Apple端,Windows/Mac/Linux桌面版

  16. Malik Wolfert表示:

    https://art-ph.com – art casino Online Support: Tugon sa Iyong Mga Tanong 24/7

  17. Wallacefex表示:

    sweet bonanza yorumlar: sweet bonanza giris – sweet bonanza demo oyna

  18. The Top Reasons People Succeed At The Replacement Door Lock Industry window lock repairs near me

  19. FrankEmine表示:

    deneme bonusu veren yeni siteler: yeni deneme bonusu veren siteler – deneme bonusu veren yeni siteler

  20. JacobLoody表示:

    https://candykitchen.ru — Candy Kitchen предлагает лучшие решения для кухонь.

  21. Raisa Malstrom表示:

    Paano Makakuha ng Registration Bonus sa https://mr-mobi-casino.com – mr mobi? Sundan Ito!

  22. Leigh表示:

    Large Fridge Freezer UK Tools To Improve Your Daily Life Large Fridge Freezer UK Trick That Every Person Must Be Able To
    large fridge freezer uk (Leigh)

  23. Otha Swansen表示:

    Ang https://defineslot.com – define slot App ay may mabilis at makatarungang gaming environment. I-download at i-install ito upang maranasan ang optimized na interface ng app para sa mas magaan na paglalaro. Mag-enjoy ka sa iyong mga paboritong laro nang walang delay.

  24. JasonUnsoG表示:

    https://casinositeleri25.com/# canl? casino siteleri

  25. BradleyEdino表示:

    casino bahis siteleri Canl? Casino Siteleri Canl? Casino Siteleri

發佈留言

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