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

10,878 Responses

  1. Greetings, I do think your web site may be having browser compatibility problems. Whenever I take a look at your blog in Safari, it looks fine however, if opening in I.E., it has some overlapping issues. I simply wanted to provide you with a quick heads up! Aside from that, excellent website.

  2. weed pen表示:

    Hi, I do believe this is an excellent website. I stumbledupon it 😉 I am going to revisit once again since i have bookmarked it. Money and freedom is the greatest way to change, may you be rich and continue to guide other people.

  3. Профессиональный сервисный центр по ремонту принтеров в Москве.
    Мы предлагаем: мастер по ремонту принтеров на дому
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  4. #javaburn表示:

    This is highly enlightening. I truly valued going through it. The content is extremely arranged and simple to understand.

  5. Профессиональный сервисный центр по ремонту принтеров в Москве.
    Мы предлагаем: принтер ремонт
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  6. Сервисный центр предлагает ремонт парогенератора supra на дому качественный ремонт парогенераторов supra

  7. W.A. Ward, “Royal-Identify Scarabs,” in Olga Tufnell, Studies on Scarab Seals, Volume 2 (Warminster: Aris & Phillips, 1984), pp.

  8. They excavated 20ft for a 6,000 sq ft automotive park and staff quarters with an indoor swimming pool and Artwork Deco cinema, there can be a helipad on the lawn.

  9. Stampdealers Stamp Store, Florida U.S.A.

  10. Do you get pleasure from harvesting cherries, or will you be disturbed by dropping fruit and wasps?

  11. Many of the proceedings of the final Assembly are embodied in resolutions.

  12. 生 食べ物表示:

    Cove lighting is characterized by way of ledges, valances, or horizontal recesses that cause the sunshine to be distributed over the ceiling and higher wall.

  13. The Bush administration and most financial forecasters don’t perceive that markets could be self-reinforcing on the draw back as effectively because the upside.

  14. 貸借銘柄表示:

    5. Again-substitute that value into the one in all the two authentic equations to find the remaining variable.

  15. Drink offers embody $6 wines from France, Portugal and Spain, 4 Northwest beers on draft for $4-$5, and 7 specialty cocktails for $6.

  16. Avoid tossing and dragging delivery containers, as an alternative of handling them with tools like forklifts, pallet jacks, and hand trucks.

  17. Under is quite a lot of boots to select from which you’ll wear whereas traveling in autumn and winter.

  18. Are there any halal restaurants in Chicago?

  19. Decorating the home is a dream of each home maker.

  20. Consider, certainly, these rights as they’re proclaimed, along with the commentary of the speaker who expounds them at the club before an viewers of heated and daring spirits, or in the road to the rude and fanatical multitude.

  21. Our two-bedroom items have one room with two constructed-in twins and a second room with a king bed.

  22. Birkenstocks are the quintessential “comfortable” sandal.

  23. He had change into nearly utterly blind, and his protective staff by no means informed him of the letter.

  24. Like all the most effective struggle memoirs, it is at once extraordinarily humorous, horrific and often tragic.

  25. The people who did see the crash are deeply psychologically scarred.

  26. 1) With the needle or knife, write the name of the corporate(s) you want to work for on the aspect of the green candle.

  27. The 3 Most Significant Disasters In Anal Butt Plug The Anal Butt Plug’s 3 Biggest Disasters In History analplug (minecraftcommand.science)

  28. Brad’s U.S. distributor, Chelsea Green Publishing.

  29. That was one among the primary fisheries to go to a kind of catch share, and it now is a really wholesome fishery, and the advantages are that the fishermen can exit once they select, when the weather is sweet, when the market worth is right.

發佈留言

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