利用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. Fmpfpd表示:

    oral lanoxin 250mg – buy avapro 150mg generic purchase lasix pills

  2. Cnmaui表示:

    famvir 250mg price – buy valaciclovir cheap order valcivir 1000mg sale

  3. Discover the ultimate journey to self-discovery with our premier ayahuasca retreat near me. Immerse yourself in transformative experiences guided by trusted experts. Book your retreat today and embark on a profound inner exploration.

  4. Zomats表示:

    order nizoral 200 mg sale – order nizoral generic itraconazole 100mg oral

  5. Keqsra表示:

    purchase semaglutide sale – DDAVP price buy desmopressin sale

  6. Gplboo表示:

    terbinafine ca – purchase forcan pills buy generic grifulvin v

  7. Larryzilex表示:

    PBN sites
    We shall build a network of self-owned blog network sites!

    Merits of our self-owned blog network:

    WE DO everything SO THAT google doesn’t comprehend that this is A privately-owned blog network!!!

    1- We obtain domains from separate registrars

    2- The primary site is hosted on a VPS server (VPS is fast hosting)

    3- Additional sites are on various hostings

    4- We allocate a distinct Google account to each site with verification in Search Console.

    5- We make websites on WP, we don’t utilise plugins with assisted by which Trojans penetrate and through which pages on your websites are generated.

    6- We do not duplicate templates and use only unique text and pictures

    We don’t work with website design; the client, if desired, can then edit the websites to suit his wishes

  8. Ellrqi表示:

    metformin 1000mg usa – losartan 25mg ca precose tablet

  9. Lmpqqu表示:

    prandin 1mg cheap – jardiance 10mg generic order empagliflozin pills

  10. Airsoft Promo is a retail airsoft store that has been selling airsoft equipment under the name Bullseye Action Target in three different locations for three years. .With the confidence of our three years of experience we desired to simulate our retail sector success on the online market.

  11. AktiveNation表示:

    Explore a world of active living with AktiveNation! Visit aktivenation.com for a diverse range of fitness products, wellness tips, and community support to help you achieve your health goals.

    aktivenation

發佈留言

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