利用Tweener製作動畫 – 數大便是美
套用徐志摩的名言:「數大」便是美,意思是說數量多就是美,不過雖然數大便是美,但如果要針對多個元件製作動畫,那利用程式一定會比手工來的輕鬆,甚至可以更漂亮和壯觀,以下的範例就是利用Tweener針對較多的元件來製作動畫的結果,分享給大家參考!希望各位未來不會「數大」便是累。
Tweener 滿天星斗:利用Tweener針對星形製作Alpha動畫,是一個很簡單的範例。
import caurina.transitions.Tweener import flash.display.MovieClip; setInterval(starFn,50) function starFn(){ var scale:Number=Math.random() var mc:MovieClip=new star mc.x=Math.random()*500 mc.y=Math.random()*500 mc.scaleX=scale mc.scaleY=scale mc.alpha=0 addChild(mc) Tweener.addTween(mc, {alpha:1, time:7, transition:"linear"}); Tweener.addTween(mc, {alpha:0, time:3,delay:8, transition:"linear"}); }
Tweener 擴散效果:利用Tweener針對球體來製作動畫,其中還應用到距離計算的Class,可以試著調整參數(彈出距離變數、彈出數量…等)來觀察改變的情況。
import flash.display.Sprite; import roMc; import flash.geom.Point; import caurina.transitions.Tweener; //變數定義區塊 var centerPoint:Point = new Point ;//圓形中心點 var i:int = 1;//迴圈變數 var radius:int = 50;//彈出距離變數 var no:int = 20;//彈出數量 var circleArray:Array=new Array//球體陣列(針對移除使用) var sec:int=1//動畫秒數 var hold:Number=0.1//延遲秒數 centerPoint.x = stage.stageWidth / 2; centerPoint.y = stage.stageHeight / 2; stage.addEventListener(MouseEvent.CLICK,clickFn); function clickFn(e:MouseEvent) { while (circleArray.length > 0) { removeChild(circleArray.pop()); } Tweener.removeAllTweens(); showFn(); } function showFn() { for (i=1; i<=no; i++) { var mc:Sprite = new ball ; circleArray.push(mc) var angle:Number = 2 * Math.PI / no * i; var targetPoint:Point = new Point(); targetPoint.x = radius * Math.cos(angle) + centerPoint.x; targetPoint.y = radius * Math.sin(angle) + centerPoint.y; addChild(mc); mc.x = centerPoint.x; mc.y = centerPoint.y; mc.alpha = 0; Tweener.addTween(mc, {alpha:1,x:targetPoint.x,y:targetPoint.y, time:sec, transition:"linear",delay:i*hold}); Tweener.addTween(mc, {alpha:0,x:centerPoint.x,y:centerPoint.y, time:sec, transition:"linear",delay:i*hold+(no*hold+1)}); } }
What’s up to all, the contents present at this web page are in fact awesome
for people experience, well, keep up the nice work fellows.
Excellent website. Lots of helpful info here. I’m sending it to several pals ans additionally sharing in delicious.
And obviously, thank you to your effort!
I’m gone to inform my little brother, that he should
also pay a visit this blog on regular basis to take updated from
most up-to-date news.
My partner and I stumbled over here from a different web address and thought I might check things out.
I like what I see so i am just following you. Look forward to exploring your web page yet again.
At this time it appears like Expression Engine is the top blogging platform available right now.
(from what I’ve read) Is that what you’re using on your blog?
Hi there! This post couldn’t be written much better!
Going through this post reminds me of my previous roommate!
He always kept preaching about this. I am going to forward this post to him.
Pretty sure he’s going to have a good read.
Thanks for sharing!
Thanks for ones marvelous posting! I actually enjoyed
reading it, you could be a great author. I will make sure to bookmark your blog and may come back in the future.
I want to encourage you to ultimately continue your great work, have a nice evening!
What’s up, its fastidious post concerning media print, we all know media is a impressive source of
information.
Hello, i think that i saw you visited my
web site thus i came to “return the favor”.I’m attempting to find things to enhance my
web site!I suppose its ok to use a few of your ideas!!
Greetings I am so excited I found your blog, I really found you by mistake, while I was browsing on Askjeeve for something else, Nonetheless
I am here now and would just like to say thanks
for a marvelous post and a all round entertaining
blog (I also love the theme/design), I don’t have time to look over it all
at the moment but I have saved it and also added
your RSS feeds, so when I have time I will be back to read a lot more, Please
do keep up the superb work.
Do you have a spam issue on this blog; I also am a
blogger, and I was wondering your situation; we have developed some nice practices and we
are looking to swap strategies with other folks, why not shoot me an email if interested.
Very energetic post, I enjoyed that a lot.
Will there be a part 2?
Hi, everything is going nicely here and ofcourse every one
is sharing information, that’s actually excellent,
keep up writing.
all the time i used to read smaller articles that
as well clear their motive, and that is also happening with this post which I am
reading at this time.
It’s enormous that you are getting thoughts from this piece of writing as well as from our
discussion made at this place.
wonderful post, very informative. I’m wondering why
the opposite specialists of this sector do not
understand this. You should continue your writing.
I am sure, you have a huge readers’ base already!
Hello, all is going sound here and ofcourse every one
is sharing facts, that’s truly fine, keep up writing.
https://pharmacywithoutprescription.life/# pharmacy without prescription
https://erectiledysfunctionpills.shop/# erection pills that work
Your article has answered the question I was wondering about! I would like to write a thesis on this subject, but I would like you to give your opinion once 😀 totosite
On this site buy pouches all known killa snus very good and trust taste!
Отличный хирург! сойфер владимир отзывы рекомендую зайти на сайт и ознакомиться с отзывами!
Отличный хирург! владимир сойфер отзывы рекомендую зайти на сайт и ознакомиться с отзывами!
Türkiye Haberleri
cat essay writer
custom college essay writing service
custome essay
санаторий сакрополь саки грязелечение в россии санатории
дом отдыха маслово база отдыха ягодная деревушка нижний новгород гранд отель гагра абхазия отзывы
порте маре в алуште цены пансионат маяк феодосия гостиница золотой колос сочи
buy cheap generic cialis uk Having more silica content in your hair may help lessen hair loss
https://amoxil.best/# amoxicillin cost australia
Отличный хирург! сойфер владимир валерьевич отзывы рекомендую зайти на сайт и ознакомиться с отзывами!
On this site buy pouches all known PURE ICE FRESH MINT very good and trust taste!