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

12,871 Responses

  1. C.Lewis表示:

    Hey there! I’m Charles. If you’re stuck in a financial Groundhog Day, duplicating the same struggles, let’s break the cycle. The 1K a Day System is your escape, leading you to new early mornings of prosperity and capacity. Get up to something fantastic!

  2. Jeden Tag stellt man sich die Frage Was Koche Ich Heute?! Zerbrechen Sie sich nicht den Kopf, besuchen Sie uns am besten direkt auf unserer Webseite uns lassen Sie sich inspirieren

  3. I couldn’t refrain from commenting. Very well written.

  4. Если вы искали где отремонтировать сломаную технику, обратите внимание – ремонт бытовой техники в челябинске

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

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

  7. 에볼루션表示:

    Very nice post. I certainly love this site. Stick with it!

  8. A fascinating discussion is definitely worth comment. I believe that you need to write more about this subject, it may not be a taboo matter but usually people do not discuss these subjects. To the next! Cheers!

  9. There are incredibly plenty of details like that take into consideration. That is the fantastic specify raise up. I offer the thoughts above as general inspiration but clearly you can find questions such as the one you raise up where the most critical factor will probably be doing work in honest very good faith. I don?t know if guidelines have emerged about things like that, but More than likely that your particular job is clearly identified as a fair game. Both boys and girls notice the impact of a moment’s pleasure, for the rest of their lives.

  10. Hey are using WordPress for your blog platform? I’m new to the blog world but I’m trying to get started and create my own. Do you require any html coding expertise to make your own blog? Any help would be greatly appreciated!

  11. you have a great blog here! would you like to make some invite posts on my weblog?

  12. Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. phieuguige-grab-bat-net

  13. Charles表示:

    Hey there, it’s Charles here, coming to you from the land of unlimited chance– or as we like to call it, the 1K a Day System. Here, we teach you how to earn more than a well-fed squirrel collects nuts for the winter. If you’re prepared to accumulate those digital acorns, get on board! Let’s make your bank account as plump as those saucy critters by signing up today.

  14. sunwin表示:

    An impressive share! I’ve just forwarded this onto a colleague who has been doing a little research on this. And he in fact ordered me dinner due to the fact that I found it for him… lol. So let me reword this…. Thanks for the meal!! But yeah, thanx for spending some time to discuss this subject here on your internet site.

  15. sunwin表示:

    I need to to thank you for this fantastic read!! I absolutely enjoyed every little bit of it. I have got you book-marked to check out new stuff you post…

  16. Very good information. Lucky me I recently found your blog by chance (stumbleupon). I’ve saved it for later!

  17. I was excited to find this website. I want to to thank you for ones time due to this wonderful read!! I definitely savored every part of it and I have you saved to fav to check out new information on your website.

  18. Spot on with this write-up, I truly believe that this website needs far more attention. I’ll probably be returning to read through more, thanks for the advice.

  19. of all the free stuffs that can come from the internet, what i love to are those free DVDs.,

  20. I am usually to blogging we really appreciate your posts. The article has really peaks my interest. Let me bookmark your blog and keep checking choosing details.

  21. After looking at a handful of the blog articles on your website, I truly appreciate your way of writing a blog. I book marked it to my bookmark webpage list and will be checking back in the near future. Take a look at my website as well and tell me what you think.

  22. Took me time to read all of the feedback, but I actually loved the article. It proved to be very useful to me and I am sure to all the commenters here! It is always good when you can’t solely learn, but in addition engaged! I’m sure you had pleasure writing this article. Anyway, in my language, there aren’t a lot good source like this.

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

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

  25. zxklgzwnu表示:

    Let’s explore this by comparing three of the biggest chains: Bitcoin, Ethereum, and Solana, and how they approach these issues. Copyright © 2018 – 2024 Crypto. All rights reserved. For this reason, the analyst thinks the upcoming bull run will be not only “crazier” but also more extended. At press time, Bitcoin remains firm, expanding above $60,000, and traders expect more gains in the days ahead. Buy BTC, ETH, and other crypto easily This year, spot crypto ETFs have dominated market spaces with billions pouring in from investors. The approval of spot Bitcoin ETFs on Jan 11 opened the gates for renewed market optimism on the heels of a new window for institutional investments. The successes of Bitcoin products drew investors to Ethereum as crypto prices jumped to new highs. The trading of ETH products expected this summer and related optimism led to issuers filing for Solana ETFs.
    https://elliottkgau405172.ziblogs.com/29294225/bitcoins
    While the total supply of 21 million BTCs is expected to be mined next century, not all can even reach the open market because more than 3.5 million bitcoins have been “lost” due to misplacing private keys or even death events. September 2019 to January 2022 The decentralized currency bitcoin is limited in supply which is mined by solving a high-level mathematical puzzle by the computers. There are only 21 million bitcoins that can be mined ever in the future, out of which; about 91.23% of bitcoins have been already mined, which accounts for around 19.1 million bitcoins. Bitcoin mining is based on the controlled supply principle, which states that only a certain number of new bitcoins can be mined yearly. Proof-of-work mining has proved to be far less popular, with governments around the globe banning the practice, including China, once home to the largest Bitcoin mines, citing its massive carbon footprint and connections to shady practices.

發佈留言

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