利用GreenSock Tweening Platform製作動畫
因為馬老師剛開始利用程式製作補間動畫的Class是Tweener,所以前面介紹了很多篇這方面的文章,但當然這方面的Class不是只有Tweener而已,所以接下來介紹一個目前發展起來比Tweener還要棒很多的Class,它是由GreenSock研發的Tweening Platform(補間平台),其中包含了:「TweenNano」、「TweenLite」、「TweenMax」、「TimelineLite」、「TimelineMax」。
為什麼說他發展得比較好呢?除了Tweener能做到的幾乎它都可以以外,也因為Tweener已經停止開發,所以未來將不會有新增的功能,但TweenMax還在不斷的更新中,在官網還有以下的比較案例:
從上面的案例可以看出來利用GreenSock所研發的Tweening Platform的執行效能會比其他的好(FPS越高越好),所以接下來就來看看GreenSock Tweening Platform的簡介。
TweenNano、TweenLite與TweenMax算是同樣功能,但在製作後檔案容量是TweenNano<TweenLite<TweenMax,也就是說利用TweenNano所製作出來的動畫容量是最小的,舉個例來說,像這樣的動畫效果,TweenNano製作後swf大小為:5KB、TweenLite:8KB、TweenMax:21KB,不過在功能上面也是TweenNano<TweenLite<TweenMax,也就是說TweenMax可以掌控的效果比較多,也更具有彈性,例如:TweenNano就沒有辦法執行:pause()、play()、restart()…等,而TweenLite沒辦法執行:貝茲曲線運動、濾鏡…等,所以要用哪個版本的Tween,端看想要製作的動畫效果來考量,官方也有針對此三者製作比較表供大家參考。
另外TimelineLite和TimelineMax算是同樣功能,但看到後面的英文單字應該可以了解與上述具有相同的關聯,而這方面的Class是可以掌握時間軸上面的變化,在Tweener中,我們只能用Delay來控制動畫先後順序,而在GreenSock所研發的Tweening Platform中則可以利用TimlinelineLite或TimelineMax來處理。
馬上來介紹有關這個Class的一些使用方式,與Tweener一樣的是必須先下載(備用載點),然後在需要使用的Flash檔案中import該Class,下載解壓後會有以下的資料夾:
- badges:GreenSock圖標。
- com:主要Class資料夾。
- demo_swfs:裡面有很多swf的展示,對於想要了解本Class非常有幫助。
- docs:參考文件。
在import時,看你想要使用的Class來import,例如需要使用TweenNano則:
import com.greensock.TweenNano;
若需同時使用TweenLite和TweenMax則:
import com.greensock.TweenLite; import com.greensock.TweenMax;
想偷懶,則:(別擔心,Flash只會內嵌有使用到的部分)
import com.greensock.*;
至於製作補間的程式碼,其實官方就有製作swf來給大家參考,這邊也把官方的範例放進來給大家參考:
上面的案例可以讓你測試動畫效果,下方也會產生該段動畫的程式碼供你使用,實在是非常方便。另外關於Tween的語法也可以改成下面這種版本:
TweenLite.from(mc, 1.5, {y:0, alpha:0});
一個是告訴動畫要去哪,另一個是告訴動畫要從哪開始變化,關於Tweener可以使用的delay、onComplete、onStart、onUpdate…等,這個Class也都可以使用,例如:
TweenLite.to(mc, 1.5, {x:100, ease:Elastic.easeOut, delay:1, onComplete:okFn}); function okFn() { trace("動畫執行完畢"); }
這個Class還有很多特別的動畫效果,例如:濾鏡、短距離旋轉、貝茲曲線、聲音、色彩變換…等,大家也可以參考官方製作的swf來參考動畫效果與取得程式碼:
在動畫控制上面可以使用如下的程式碼來控制動畫:
var myTween:TweenLite = new TweenLite(mc, 1, {x:100, y:100}); myTween.pause(); //暫停動畫播放 myTween.resume(); //恢復動畫播放 myTween.reverse(); //反向播放 myTween.play(); //播放動畫 myTween.restart(); //重播動畫 myTween.invalidate(); //移除補間並使元件恢復原始狀態 myTween.kill(); //清除補間動畫 TweenLite.killTweensOf(mc); //清除所有物件之補間動畫
以上是有關GreenSock Tweening的介紹,接下來介紹有關TimelineLite與TimelingMax的部分。
就像上面有提到在Tweener中我們如果希望三個元件在不同的時間點開始移動,就只能使用delay或是另外寫程式來控制,現在我們可以使用Timeline相關的Class來完成這樣的任務,甚至還可以讓時間軸倒著播放也沒問題,以下就是有關TimelineLite的官方範例:
另外是TimelineMax的範例檔,供大家參考:
以上就是針對GreenSock Tweening Platform大致的介紹,建議有空可以前往官網鑽研更多其他的功能,另外其實GreenSock另外還有TransformManager和LoaderMax,各位也可以先參考官網文章或是未來再跟大家分享我的使用心得。
註:本範例所使用的範例版權屬於GreenSock公司所有。
Online medicine home delivery: п»їlegitimate online pharmacies india – best india pharmacy
создание и продвижение сайтов создание и продвижение сайтов .
Здравствуйте!
Мы готовы предложить дипломы любых профессий.
Покупка документа, подтверждающего окончание института, – это разумное решение.
newmedtime.ru/page/5
Всегда вам поможем!.
Привет!
Мы изготавливаем дипломы любой профессии.
Приобретение документа, который подтверждает окончание института, – это выгодное решение.
fat-girls.ru/page/5
Окажем помощь!.
сео москва сео москва .
I used to be able to find good information from your blog articles.
canadian pharmacy 24h com safe: canadian pharmacies online – canadian drug prices
ремонт телевизоров г москва
Привет, друзья!
Легальная покупка школьного аттестата с упрощенной программой обучения
ru-lol-best.blogspot.com/2011/06/blog-post_4840
Окажем помощь!.
Добрыйдень!
Купить диплом о высшем образовании.
telegra.ph/kupit-diplom-svarshchika-cena-08-13-8
Also visit my website: Explore Daycares Locations
ремонт телевизоров москва
Regulated United Europe was established in 2014 in order to help physical and legal entities in bank account opening. Based on our long-term experience, we have established a number of trustworthy partnerships with reliable banks all over Europe. Our specialist will be able to do all preliminary work for you based on your needs and project in order to find the best suitable solution for you, that will substantially save your time.
The Czech Republic offers unique opportunities for manufacturing and export-oriented businesses due to its central position in Europe and strong industrial base. The country has a stable economy, low levels of corruption and maintains a healthy business environment with access to a large and solvent domestic market. The Czech Republic also offers relatively low operating costs and a well-developed infrastructure, making it attractive to various types of businesses.
Conclusion: Estonia, Lithuania, Ireland and the Czech Republic represent the four most attractive countries in Europe for foreigners to start a business. They offer a variety of economic and strategic advantages, including low taxes, a high degree of innovation, access to international markets and a supportive business environment. Choosing the right country depends on the specific goals and needs of your business.
Regulated United Europe se esfuerza constantemente por mejorar su rendimiento y el nivel de los servicios prestados, basandose en las constantes observaciones de sus clientes y captando las necesidades del mercado de servicios juridicos en varios paises europeos. El tiempo de respuesta a las consultas/correos electronicos de los clientes tambien se mantiene al minimo.
En el ambito de los precios, Regulated United Europe intenta adaptarse a las necesidades de los clientes ofreciendo un precio fijo para la mayoria de los servicios juridicos prestados, a pesar de que en la mayoria de los paises europeos se aplican honorarios legales por hora.
Proporcionamos asesoramiento juridico y apoyo diario a nuestros clientes en todas las fases de la ejecucion de sus proyectos. Un equipo de abogados experimentados desarrolla soluciones complejas de forma individual para cada cliente.
http://mexstarpharma.com/# п»їbest mexican online pharmacies
https://lebedkashop.ru/
https://easyrxcanada.online/# best canadian pharmacy
Also visit my site … Explore Daycares Locations
Die Fintech-Anwalte und Finanzberater von RUE (Regulated United Europe) haben einen Blog erstellt, in dem sie die neuesten Anderungen in der Gesetzgebung der europaischen Lander im Bereich Kryptowahrung und VASP (Virtual Asset Service Provider) veroffentlichen, um allen, die sich fur die Kryptowahrungsgesetzgebung in Europa interessieren, einen Uberblick zu geben. Wir stutzen unsere Artikel auf Themen, die fur die heutigen Unternehmer, die im Bereich der Kryptowahrung, Fintech-Projekte, Blockchain und IT-bezogenen Unternehmen arbeiten, wichtig sind. Wenn Sie die Informationen, die Sie interessieren, in unserem Blog nicht finden konnen, kontaktieren Sie uns bitte auf bequeme Art und Weise.
Профессиональный сервисный центр по ремонту ноутбуков, макбуков и другой компьютерной техники.
Мы предлагаем:ремонт ноутбуков apple москва
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Feel free to surf to my web blog; Daycare Near Me
my homepage :: poker Online free
https://mexstarpharma.online/# п»їbest mexican online pharmacies
Regulated United Europe, musterilerden gelen surekli geri bildirimlere dayanarak ve cesitli Avrupa ulkelerindeki hukuki hizmetlere yonelik pazar ihtiyaclar?n? dikkate alarak performans?n? ve sunulan hizmetlerin duzeyini surekli olarak iyilestirmeye cal?smaktad?r. Musteri sorular?na/e-postalar?na yan?t suresi de minimumda tutulur.
Fiyatland?rma alan?nda, Regulated United Europe, cogu hukuki hizmette sabit bir fiyat sunarak musterilerin ihtiyaclar?na uyum saglamaya cal?smaktad?r. Avrupa ulkeleri ag?rl?kl? olarak saatlik yasal ucretler uygulanmaktad?r.
Muvekkillerimize proje uygulamalar?n?n her asamas?nda hukuki dan?smanl?k ve gunluk destek sagl?yoruz. Karmas?k cozumler, deneyimli avukatlardan olusan bir ekip taraf?ndan her muvekkil icin ayr? ayr? gelistirilmektedir.
It would seem that Maltese taxation is quite severe and the corporate income tax rate does not suggest that Malta is a low tax jurisdiction. However, this is not the case. The fact is that non-resident companies in Malta are entitled to a refund of taxes paid, which allows us to talk about the lower level of taxation in Malta compared to most countries in the world.
In order to claim a corporate income tax refund, a foreign company must be registered in Malta as a trading or holding company (deriving its income from trading activities or from participation in other organisations, respectively).
In the tax accounting of a Maltese company, the income earned by it must be recorded in one of four tax accounts: “foreign profits”, “Maltese profits”, “profits from immovable property”, “non-taxable income”. Each type of income is taxed according to its own rules. The final amount of tax is recorded in the fifth account “final tax”.
Example. Consider the two most common cases: a Maltese company derives profits from trading activities abroad and from participation in other companies. In either case, these profits are subject to statutory tax at 35 per cent, but the Maltese shareholders are entitled to claim a refund of the tax taken from the dividends distributed. The refund rules differ for different types of income.
If a Maltese company derives income from trading activities outside Malta (and the term “trading” includes both the direct purchase and sale of goods and the provision of services), its shareholders are entitled, upon receipt of the dividend, to apply for a refund of 6/7th of the tax previously paid in Malta. Therefore, the effective income tax rate will be 5 per cent.
Regulated United Europe has over 8 years of experience and has over 200 trustworthy partnerships with reliable banks all over Europe. We highly value partnership and long-term business cooperation, and try to expand our partner network every year. We always move forward and are finding new partnership options within the most progressive and safe EMIs and banks in the European region. Our partners have a high level of professionalism and timely fulfil their obligations.
Your style is unique in comparison to other folks I have read stuff from. Thank you for posting when you’ve got the opportunity, Guess I’ll just bookmark this blog.
ремонт телевизоров
ремонт телевизионного оборудования