利用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公司所有。
Nice post. I learn something totally new and challenging on blogs I stumbleupon every day. It’s always helpful to read content from other authors and practice a little something from other web sites.
best online pharmacies in mexico: medication from mexico pharmacy – mexico drug stores pharmacies
My web site :: Explore Daycares Locations
world pharmacy india: top 10 online pharmacy in india – online shopping pharmacy india
I’d like to thank you for the efforts you have put in writing this site. I really hope to check out the same high-grade blog posts from you in the future as well. In truth, your creative writing abilities has motivated me to get my own, personal blog now 😉
вывод из запоя на дому http://vyvod-iz-zapoya-ekaterinburg11.ru .
вывод из запоя на дому https://vyvod-iz-zapoya-ekaterinburg.ru/ .
Здравствуйте!
Диплом юриста
telegra.ph/kupit-diplom-instituta-fizkultury-08-22-2
Also visit my homepage Daycares By Category
вывод из запоя на дому https://www.vyvod-iz-zapoya-ekaterinburg.ru .
вызов на дом выведение из запоя вызов на дом выведение из запоя .
Привет!
Диплом по специальности на выбор
jamsun.net/doku.php?id
Spot on with this write-up, I really think this amazing site needs much more attention. I’ll probably be back again to see more, thanks for the information!
вывод из запоя краснодар клиника вывод из запоя краснодар клиника .
Here is my site: Find top-rated certified Daycares in your area
вывод из запоя на дому круглосуточно краснодар вывод из запоя на дому круглосуточно краснодар .
Look at my blog post :: Daycares By Category
Right here is the perfect blog for anyone who really wants to understand this topic. You know so much its almost hard to argue with you (not that I actually would want to…HaHa). You certainly put a fresh spin on a subject that has been discussed for many years. Excellent stuff, just great.
вывод из запоя капельница краснодар вывод из запоя капельница краснодар .
вывод из запоя в стационаре краснодара вывод из запоя в стационаре краснодара .
вывод из запоя в краснодаре вывод из запоя в краснодаре .
Tiny shards of plastic are increasingly infiltrating our brains, study says
красивый анальный секс
Human brain samples collected at autopsy in early 2024 contained more tiny shards of plastic than samples collected eight years prior, according to a preprint posted online in May. A preprint is a study which has not yet been peer-reviewed and published in a journal.
“The concentrations we saw in the brain tissue of normal individuals, who had an average age of around 45 or 50 years old, were 4,800 micrograms per gram, or 0.5% by weight,” said lead study author Matthew Campen, a regents’ professor of pharmaceutical sciences at the University of New Mexico in Albuquerque.
“Compared to autopsy brain samples from 2016, that’s about 50% higher,” Campen said. “That would mean that our brains today are 99.5% brain and the rest is plastic.”
That increase, however, only shows exposure and does not provide information about brain damage, said Phoebe Stapleton, an associate professor of pharmacology and toxicology at Rutgers University in Piscataway, New Jersey, who was not involved in the preprint.
“It is unclear if, in life, these particles are fluid, entering and leaving the brain, or if they collect in neurological tissues and promote disease,” she said in an email. “Further research is needed to understand how the particles may be interacting with the cells and if this has a toxicological consequence.”
The brain samples contained 7% to 30% more tiny shards of plastic than samples from the cadavers’ kidneys and liver, according to the preprint.
“Studies have found these plastics in the human heart, the great blood vessels, the lungs, the liver, the testes, the gastrointestinal tract and the placenta,” said pediatrician and biology professor Dr. Philip Landrigan, director of the Program for Global Public Health and the Common Good and the Global Observatory on Planetary Health at Boston College.
“It’s important not to scare the hell out of people, because the science in this space is still evolving, and nobody in the year 2024 is going to live without plastic,” said Landrigan, who was not involved with the preprint.
вывод из запоя цены краснодар вывод из запоя цены краснодар .
где можно починить телефон
Привет!
Купить документ о получении высшего образования
topfoto.ru/index.php?links_exchange=yes&page=1&show_all=yes
сервисный центр мобильных телефонов
Здравствуйте!
Приобрести диплом о высшем образовании.
forum.gold-forum.ru/index.php?showtopic=70791
Hello there! This post couldn’t be written any better! Reading through this article reminds me of my previous roommate! He continually kept talking about this. I will forward this article to him. Fairly certain he will have a good read. Thank you for sharing!
LГҐn 25000
Здравствуйте!
Быстрая схема покупки диплома старого образца: что важно знать?
penelopesplace.net/2012/06/07/a-c-petersens/comment-page-3546/#comment-758197
Окажем помощь!.