利用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,369 Responses

  1. JacobLoody表示:

    http://www.pravoslavieug.ru — Узнайте больше о дизайнерских решениях на сайте pravoslavieug.

  2. JacobLoody表示:

    http://www.nedra2021.ru — ваш партнёр в создании идеальной кухни.

  3. Wallacefex表示:

    deneme bonusu veren seat: Casino Siteleri – Canl? Casino Siteleri

  4. porn video表示:

    Your style is unique in comparison to other folks I’ve read stuff from. Many thanks for posting when you’ve got the opportunity, Guess I’ll just bookmark this web site.

  5. BradleyEdino表示:

    sweet bonanza giris sweet bonanza guncel sweet bonanza yorumlar

  6. KODrth表示:

    Every time I reread this post, I find more and more deep meaning in it https://bhjoa.ilyx.ru/id-6277.html

  7. Christin表示:

    10 Train Accident Law Firm Strategies All The Experts Recommend serious truck accident lawyer (Christin)

  8. 10 Facts About Asbestos Attorney Cancer Lawyer Mesothelioma That Make You Feel Instantly An Upbeat Mood
    mesothelioma lawsuit

  9. Refugio Hunten表示:

    Sa https://stake-ph.com – stake, nag-aalok kami ng patas at makatarungang laro sa lahat ng manlalaro. Subukan ang mga sikat na laro tulad ng poker, roulette, at sports betting. Higit pa rito, makakuha ng maraming bonus na eksklusibo para sa mga loyal na customer.

  10. JacobLoody表示:

    http://candykitchen.ru/ — Простота заказа кухни через удобный интерфейс сайта Candy Kitchen.

  11. Donnie Housman表示:

    Maglaro sa https://8k8-slot-ph.com – 8k8 slot, ang platform na kilala sa patas at makatarungang laro. Tuklasin ang kanilang malawak na seleksyon ng mga sikat na laro tulad ng slots at blackjack. Dagdag pa, maraming bonus ang naghihintay upang bigyan ka ng dagdag na saya at panalo!

  12. Wifefpf表示:

    The author touched on exactly those problems that many are afraid to talk about openly https://rsmmi.ilyx.ru/id-6683.html

  13. Dreampgs表示:

    The author raises really important questions that concern absolutely each of us today https://wgsft.ilyx.ru/id-7128.html

  14. Leora Vlahos表示:

    https://exclusive-ph.com – exclusive: Tuklasin ang Pinakasikat na Laro sa Online Pagsusugal

  15. FrankEmine表示:

    sweet bonanza demo oyna: sweet bonanza slot – sweet bonanza kazanma saatleri

  16. porn video表示:

    Oh my goodness! Incredible article dude! Many thanks, However I am having problems with your RSS. I don’t know the reason why I am unable to join it. Is there anyone else having identical RSS problems? Anyone who knows the solution will you kindly respond? Thanx.

  17. Joesph Markowitz表示:

    Ang https://exclusive-ph.com – exclusive ay tahanan ng maraming sikat na laro sa pagsusugal tulad ng slot games, baccarat, at roulette. Ang bawat laro ay patas at makatarungan, kaya’t sigurado ang integridad ng bawat transaksyon. Bukod dito, maraming bonus ang naghihintay upang gawing mas kapanapanabik ang iyong karanasan.

  18. пропуск для грузовиков в москву urilin.ru .

  19. JacobLoody表示:

    http://www.arch-mag.ru — Заходите на сайт arch-mag и начните создавать свою идеальную кухню.

發佈留言

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