<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>It's FROGiology &#187; tweener</title>
	<atom:link href="http://blog.frogiology.com/tag/tweener/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.frogiology.com</link>
	<description>the study about me</description>
	<lastBuildDate>Sat, 16 Jan 2010 19:26:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Tweener 有無用武之地的時候?</title>
		<link>http://blog.frogiology.com/2008/09/13/flash-tweener-lesson5-not-suitable/</link>
		<comments>http://blog.frogiology.com/2008/09/13/flash-tweener-lesson5-not-suitable/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 03:57:16 +0000</pubDate>
		<dc:creator>Stanley Fok</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[tweener]]></category>

		<guid isPermaLink="false">http://blog.frogiology.com/?p=198</guid>
		<description><![CDATA[Tweener 雖然幫我們很方便地做到漂亮的效果，但是在某些情況下，Tweener卻無用武之地了。主要原因就是電腦的計算效能是有上限，如果很頻密地或是一次過使用大量Tweener，Flash 就會不勝負荷而出現「跳格」的情況了。本來想要流暢的效果，到頭來卻有反效果呢&#8230; 看看以下例子，stage上有500個圓形，當你scroll mouse時，圓形的scaleX及scaleY是用Tweener來改變的。由於MOUSE_WHEEL這個事件，會因為你捲動mouse時頻密地呼叫，因此電腦不勝負荷了。 View in new window 要解決這個問題，我們唯有放棄Tweener。沒有Tweener如何可以達到流暢的tweeing呢? 很簡單，不知大家記不記得我在Lesson 2中說過一個舊式的tweening方法? 現在重溫一次吧﹕ myMc.x += (targetX – myMc.x) / FACTOR; //targetX 是目標的X座標 //FACTOR是一個constant，數字愈大，easing的時間愈長 所以解決辦法是，當mouse scroll時，我們只要改變圓形scale的目標數值，然後在ENTER_FRAME事件中，利用以上tweening formula去改動圓形的scaleX及scaleY。方法很簡單，也十分有效呢~ View in new window 下載所有例子: Tweener Tutorial Examples (1.8Mb) 結語: 到了這裡，我的Tweener教學也完結了。希望大家做Flash的時候，能夠想多一步，盡量使用Tweener美化你的RIA。另一方面，你也要知道Flash的能力是有上限的，小心地設計及優化每一個animation的程式碼。能做到以上兩點，你定可成為出色的RIA Developer! &#62;&#62; 看其他教學]]></description>
			<content:encoded><![CDATA[<p>Tweener 雖然幫我們很方便地做到漂亮的效果，但是在某些情況下，Tweener卻無用武之地了。主要原因就是電腦的計算效能是有上限，如果很頻密地或是一次過使用大量Tweener，Flash 就會不勝負荷而出現「跳格」的情況了。本來想要流暢的效果，到頭來卻有反效果呢&#8230;</p>
<p><span id="more-198"></span></p>
<p>看看以下例子，stage上有500個圓形，當你scroll mouse時，圓形的scaleX及scaleY是用Tweener來改變的。由於MOUSE_WHEEL這個事件，會因為你捲動mouse時頻密地呼叫，因此電腦不勝負荷了。</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/11_tweener_not_suitable.swf" /><embed type="application/x-shockwave-flash" width="480" height="250" src="http://blog.frogiology.com/upload/tutorial/tweener/11_tweener_not_suitable.swf"></embed></object><a href="http://blog.frogiology.com/upload/tutorial/tweener/11_tweener_not_suitable.html" target="_blank"><br />
View in new window<br />
</a></p>
<p>要解決這個問題，我們唯有放棄Tweener。沒有Tweener如何可以達到流暢的tweeing呢? 很簡單，不知大家記不記得我在<a title="介紹 Tweener" href="http://blog.frogiology.com/2008/08/29/flash-tweener-lesson2-introduction/" target="_blank">Lesson 2</a>中說過一個舊式的tweening方法? 現在重溫一次吧﹕</p>
<pre><code>myMc.x += (targetX – myMc.x) / FACTOR;
//targetX 是目標的X座標
//FACTOR是一個constant，數字愈大，easing的時間愈長</code></pre>
<p>所以解決辦法是，當mouse scroll時，我們只要改變圓形scale的目標數值，然後在ENTER_FRAME事件中，利用以上tweening formula去改動圓形的scaleX及scaleY。方法很簡單，也十分有效呢~</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/11_tweener_not_suitable_solution.swf" /><embed type="application/x-shockwave-flash" width="480" height="250" src="http://blog.frogiology.com/upload/tutorial/tweener/11_tweener_not_suitable_solution.swf"></embed></object><a href="http://blog.frogiology.com/upload/tutorial/tweener/11_tweener_not_suitable_solution.html" target="_blank"><br />
View in new window<br />
</a></p>
<p>下載所有例子: <a title="Tweener Tutorial Examples" href="http://blog.frogiology.com/upload/tutorial/tweener/tweener_tutorial.zip">Tweener Tutorial Examples</a> (1.8Mb)</p>
<p><strong>結語:</strong></p>
<p>到了這裡，我的Tweener教學也完結了。希望大家做Flash的時候，能夠想多一步，盡量使用Tweener美化你的RIA。另一方面，你也要知道Flash的能力是有上限的，小心地設計及優化每一個animation的程式碼。能做到以上兩點，你定可成為出色的RIA Developer!</p>
<p>&gt;&gt; <a title="看其他教學" href="http://blog.frogiology.com/tutorials/">看其他教學</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.frogiology.com/2008/09/13/flash-tweener-lesson5-not-suitable/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Tweener 10大用途</title>
		<link>http://blog.frogiology.com/2008/09/07/flash-tweener-lesson3-10-usages/</link>
		<comments>http://blog.frogiology.com/2008/09/07/flash-tweener-lesson3-10-usages/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 11:06:07 +0000</pubDate>
		<dc:creator>Stanley Fok</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[papervision3d]]></category>
		<category><![CDATA[tweener]]></category>
		<category><![CDATA[usage]]></category>

		<guid isPermaLink="false">http://blog.frogiology.com/?p=162</guid>
		<description><![CDATA[很多人都以為Tweener只是可以用來Tween Movieclip的屬性，只局限了在二維空間內發揮。但其實如果懂得利用，它的用途可以是非常廣泛的，令人嘆為觀止的RIA也亦由此而來。現在讓Stanley介紹Tweener 10式吧! &#62;&#62; 下載所有例子: Tweener Tutorial Examples (1.8Mb) &#60;&#60; 1. Smooth Drag and Drop Flash 其實已提供了startDrag(); 功能讓你做到拖曳，可是用這方法來拖曳東西總是給人很不爽的感覺。但是如果在MouseMove 事件用了Tweener來Tween MovieClip的x及y座標後，感覺截然不同了! 請試試看~ &#62;&#62; 下載&#8221;Smooth Drag and Drop&#8221; source code 2. Number Counter Tweener本來就是用來interpolate數值的，因此很順理成章我們可以用它來做計數器。如果沒有Tweener，你可能要利用EnterFrame事件，並且加上很麻煩的邏輯來完成，很花時間。現在用了Tweener，幾行的程式碼就可做到了! 這個計數器可應用在計分板之類的地方，定可為你的RIA帶來多些生氣呢~ &#62;&#62; 下載&#8221;Number Counter&#8221; source code 3. Content Scroller 這次都是用了Tweener控制MovieClip的x,y座標，但是如果懂得利用，可以做出以下的捲動效果。幾行程式碼而已，誰也可以做到! &#62;&#62; 下載&#8221;Content Scroller&#8221; source code 4. Animation Sequence 以前要做一連串的animation，通常一想到就是用timer function做 (即AS2的setInterval)。可是用timer時，你就要控制何時要移除timer，頗麻煩的。但你又知不知設定Tweener時，你可以加入&#8221;delay&#8221;這個設定? 如&#8221;delay&#8221;是1，tweening將會於一秒後開始。利用delay，你只要在一個for loop中加入Tweener，並給予不同delay的數值，也可以做到同樣效果! &#62;&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>很多人都以為Tweener只是可以用來Tween Movieclip的屬性，只局限了在二維空間內發揮。但其實如果懂得利用，它的用途可以是非常廣泛的，令人嘆為觀止的RIA也亦由此而來。現在讓Stanley介紹Tweener 10式吧!</p>
<p><span style="color: #ff6600;"><strong>&gt;&gt;</strong></span><span style="font-size: small; color: #ff6600;"><strong><span> 下載所有例子: <a title="Tweener Tutorial Examples" href="http://blog.frogiology.com/upload/tutorial/tweener/tweener_tutorial.zip">Tweener Tutorial Examples</a> (1.8Mb) &lt;&lt;<br />
</span></strong></span></p>
<p><span id="more-162"></span></p>
<p><strong>1. Smooth Drag and Drop</strong></p>
<p>Flash 其實已提供了startDrag(); 功能讓你做到拖曳，可是用這方法來拖曳東西總是給人很不爽的感覺。但是如果在MouseMove 事件用了Tweener來Tween MovieClip的x及y座標後，感覺截然不同了! 請試試看~</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/1_drag_n_drop.swf" /><embed type="application/x-shockwave-flash" width="480" height="250" src="http://blog.frogiology.com/upload/tutorial/tweener/1_drag_n_drop.swf"></embed></object><br />
&gt;&gt; <a href="http://blog.frogiology.com/upload/tutorial/tweener/1_drag_n_drop.zip">下載&#8221;Smooth Drag and Drop&#8221; source code</a></p>
<p><strong>2. Number Counter</strong></p>
<p>Tweener本來就是用來interpolate數值的，因此很順理成章我們可以用它來做計數器。如果沒有Tweener，你可能要利用EnterFrame事件，並且加上很麻煩的邏輯來完成，很花時間。現在用了Tweener，幾行的程式碼就可做到了! 這個計數器可應用在計分板之類的地方，定可為你的RIA帶來多些生氣呢~</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/2_number_counter.swf" /><embed type="application/x-shockwave-flash" width="480" height="250" src="http://blog.frogiology.com/upload/tutorial/tweener/2_number_counter.swf"></embed></object><br />
&gt;&gt; <a href="http://blog.frogiology.com/upload/tutorial/tweener/2_number_counter.zip">下載&#8221;Number Counter&#8221; source code</a></p>
<p><strong>3. Content Scroller</strong></p>
<p>這次都是用了Tweener控制MovieClip的x,y座標，但是如果懂得利用，可以做出以下的捲動效果。幾行程式碼而已，誰也可以做到!</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/3_content_scroller.swf" /><embed type="application/x-shockwave-flash" width="480" height="250" src="http://blog.frogiology.com/upload/tutorial/tweener/3_content_scroller.swf"></embed></object><br />
&gt;&gt; <a href="http://blog.frogiology.com/upload/tutorial/tweener/3_content_scroller.zip">下載&#8221;Content Scroller&#8221; source code</a></p>
<p><strong>4. Animation Sequence</strong></p>
<p>以前要做一連串的animation，通常一想到就是用timer function做 (即AS2的setInterval)。可是用timer時，你就要控制何時要移除timer，頗麻煩的。但你又知不知設定Tweener時，你可以加入&#8221;delay&#8221;這個設定? 如&#8221;delay&#8221;是1，tweening將會於一秒後開始。利用delay，你只要在一個for loop中加入Tweener，並給予不同delay的數值，也可以做到同樣效果!</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/4_animation_sequence.swf" /><embed type="application/x-shockwave-flash" width="480" height="250" src="http://blog.frogiology.com/upload/tutorial/tweener/4_animation_sequence.swf"></embed></object><br />
&gt;&gt; <a href="http://blog.frogiology.com/upload/tutorial/tweener/4_animation_sequence.zip">下載&#8221;Animation Sequence&#8221; source code</a></p>
<p><strong>5. Simulation of Locus</strong></p>
<p>Locus即軌跡，是指物件在二維或三維空間走過的路徑。好像下面兩個例子，是拋物線及四分一個圓的弧線，如果要做，可以寫數式去做，不過會很麻。不過如果你懂得把x及y分開來tween，並且善用Tweener提供的transition type，這個效果幾行程式碼就可完成了!</p>
<p>以拋物線為例，x 就用linear transition tween 2秒，y就先用easeOutQuad transition tween 1秒，之後再用easeInQuad transition tween 1秒回到原來的y就可。為何是 easeOutQuad 及 easeInQuad? 因為在物理世界中，物件受地心吸力下的拋物線是二元算式來的(quadratic equation)。圓形則用easeInSine 及 easeOutSine分別處理x及y座標就可以了。</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/5_simulation_of_locus.swf" /><embed type="application/x-shockwave-flash" width="480" height="250" src="http://blog.frogiology.com/upload/tutorial/tweener/5_simulation_of_locus.swf"></embed></object><br />
&gt;&gt; <a href="http://blog.frogiology.com/upload/tutorial/tweener/5_simulation_of_locus.zip">下載&#8221;Simulation of Locus&#8221; source code</a></p>
<p><strong>6. Fading Sound Volume</strong></p>
<p>不說不知，聲音大小也可以tween啊，這樣是不是比直接把聲量定為0或1更自然呢?</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/6_fading sound_volume.swf" /><embed type="application/x-shockwave-flash" width="480" height="250" src="http://blog.frogiology.com/upload/tutorial/tweener/6_fading sound_volume.swf"></embed></object><br />
&gt;&gt;&gt; <a href="http://blog.frogiology.com/upload/tutorial/tweener/6_fading sound_volume.zip">下載&#8221;Fading Sound Volume&#8221; source code</a></p>
<p><strong>7. Spony Objects</strong></p>
<p>Tweener有幾個transition type幾好玩的，就是easeOutBack及easeOutElastic。利用它們可以做出感覺很有彈性的東西呢~ 很多日本人做的RIA經常用這個效果的啊!</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/7_spony_object.swf" /><embed type="application/x-shockwave-flash" width="480" height="250" src="http://blog.frogiology.com/upload/tutorial/tweener/7_spony_object.swf"></embed></object><br />
&gt;&gt; <a href="http://blog.frogiology.com/upload/tutorial/tweener/7_spony_object.zip">下載&#8221;Spony Objects&#8221; source code</a></p>
<p><strong>8. Tween the Blur Filter</strong></p>
<p>玩到沒東西好玩了~ Blur Filter 也tween來試試看吧!</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/8_tween_blur_filter.swf" /><embed type="application/x-shockwave-flash" width="480" height="250" src="http://blog.frogiology.com/upload/tutorial/tweener/8_tween_blur_filter.swf"></embed></object><br />
&gt;&gt; <a href="http://blog.frogiology.com/upload/tutorial/tweener/8_tween_blur_filter.zip">下載&#8221;Tween the Blur Filter&#8221; source code</a></p>
<p><strong>9. Tween in Papervision3D</strong></p>
<p>相信這是最好玩的了! 留意RIA的朋友也應該聽過Papervision3D吧，它是一個open source的Flash 3D engine。在Papervision3D中，camera及 一般DisplayObject3D也有x,y及z的屬性。喜歡甚麼也tween一回的Stanley，今次又有東西玩了! 讓我只是tween camera的位置及望向的位置，只是簡單的程式碼又可以做到厲害的效果了!</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/9_tween_in_papervision3d.swf" /><embed type="application/x-shockwave-flash" width="480" height="400" src="http://blog.frogiology.com/upload/tutorial/tweener/9_tween_in_papervision3d.swf"></embed></object><br />
&gt;&gt; <a href="http://blog.frogiology.com/upload/tutorial/tweener/9_tween_in_papervision3d.zip">下載&#8221;Tween in Papervision3D&#8221; source code</a></p>
<p><strong>10. Tween the Function</strong></p>
<p>最後一招，Tweener提供了Tweener.addCaller(); 的功能，你可以用它來設定一個時間入call一個function多少次，而call function的頻率，是用transition type的控制。以下面的例子來說，我有一個function是用來創建圓形的，你可以見到圓形是創建得愈來愈快的，這是因為用了transition type有關。</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.frogiology.com/upload/tutorial/tweener/10_timer_function.swf" /><embed type="application/x-shockwave-flash" width="480" height="250" src="http://blog.frogiology.com/upload/tutorial/tweener/10_timer_function.swf"></embed></object><br />
&gt;&gt; <a href="http://blog.frogiology.com/upload/tutorial/tweener/10_timer_function.zip">下載&#8221;Tween the Function&#8221; source code</a></p>
<p>&gt;&gt; <a title="Lesson 5: Tweener 有無用武之地的時候?" href="http://blog.frogiology.com/2008/09/13/flash-tweener-lesson5-not-suitable/">Lesson 5: Tweener 有無用武之地的時候?<strong><strong></strong></strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.frogiology.com/2008/09/07/flash-tweener-lesson3-10-usages/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Tweener 語法實習</title>
		<link>http://blog.frogiology.com/2008/08/31/flash-tweener-lesson3-syntax/</link>
		<comments>http://blog.frogiology.com/2008/08/31/flash-tweener-lesson3-syntax/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 17:28:12 +0000</pubDate>
		<dc:creator>Stanley Fok</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[syntax]]></category>
		<category><![CDATA[tweener]]></category>

		<guid isPermaLink="false">http://blog.frogiology.com/?p=144</guid>
		<description><![CDATA[Tweener提供的API非常易用，如果你不是programmer，也應該可以看得懂Tweener的syntax。現在讓Stanley說一說一些經常會用的Tweener的函數: 1. Tweener.addTween(target:Object, tweeningParameters:Object):Void 例子1﹕ Tweener.addTween(myMc, {   x: 100, //a property of the movieclip "myMc"   y: 100, //a property of the movieclip "myMc"   alpha: 0.5, //a property of the movieclip "myMc"   time: 1, //required   delay: 1, //optional   transition: "easeOutQuad" //optional, default value is "easeOutExpo" }); 說明: x、y及alpha都是myMc的屬性，我們都可以tween它們的值 time 是指tweening的總時間，以秒做單位 [...]]]></description>
			<content:encoded><![CDATA[<p>Tweener提供的API非常易用，如果你不是programmer，也應該可以看得懂Tweener的syntax。現在讓Stanley說一說一些經常會用的Tweener的函數:</p>
<p><span id="more-144"></span></p>
<p><strong>1. Tweener.addTween(target:Object, tweeningParameters:Object):Void</strong></p>
<p>例子1﹕</p>
<pre><code>Tweener.addTween(myMc, {
  x: 100, <span style="color: #008000;">//a property of the movieclip "myMc"
</span>  y: 100, <span style="color: #008000;">//a property of the movieclip "myMc"</span>
  alpha: 0.5, <span style="color: #008000;">//a property of the movieclip "myMc"</span>
  time: 1, <span style="color: #008000;">//required</span>
  delay: 1, <span style="color: #008000;">//optional</span>
  transition: "easeOutQuad" <span style="color: #008000;">//optional, default value is "easeOutExpo"</span>
});</code></pre>
<p>說明:</p>
<ul>
<li>x、y及alpha都是myMc的屬性，我們都可以tween它們的值</li>
<li>time 是指tweening的總時間，以秒做單位</li>
<li>delay是tweening等多少秒才開始，以秒做單位</li>
<li>transition是指用甚麼的easing formula，可查看<a title="Tweener transition types" href="http://hosted.zeh.com.br/tweener/docs/en-us/misc/transitions.html" target="_blank">Tweener transition types</a></li>
</ul>
<p>例子2﹕</p>
<pre><code>function doStart() { trace("start!"); }
function doUpdate() { trace("update!"); }
function doComplete() { trace("complete!"); }</code>

<code>Tweener.addTween(myMc, {
  alpha: 1, <span style="color: #008000;">//a property of the movieclip "myMc"</span>
  time: 1, <span style="color: #008000;">//required</span>
  onStart: doStart,
  onUpdate: doUpdate,
  onComplete: doComplete
});</code></pre>
<p>說明:</p>
<p>這兒介紹了三個parameters:</p>
<ul>
<li>onStart: 當Tweener開始時會呼叫的function</li>
<li>onUpdate: 當Tweener進行tweening時會呼叫的function，如tweening是1 秒，這個function就會在1秒內不斷被呼叫。onUpdate 這個handler是經常會用的!</li>
<li>onComplete: 當Tweener完成時會呼叫的function</li>
</ul>
<p><strong>2. Tweener.isTweening(target:Object):Boolean;</strong></p>
<p>檢查myMc這個object是否還進行tweening中。</p>
<p><strong>3. Tweener.pauseAllTweens():Boolean;</strong></p>
<p>暫停<strong>所有</strong>object進行中tweening</p>
<p><strong>4. Tweener.pauseTweens(target:Object, [, property1:String, property2:String, ...]):Boolean;</strong><!-- InstanceEndEditable --></p>
<p>暫停一個object所有或其中一些屬性的tweening。</p>
<p><strong>5. Tweener.resumeAllTweens():Boolean;</strong></p>
<p>繼續<strong>所有</strong>object原本進行中tweening</p>
<p><strong>6. Tweener.resumeTweens(target:Object, [, property1:String, property2:String, ...]):Boolean;</strong><!-- InstanceEndEditable --></p>
<p>繼續一個object所有或其中一些屬性的tweening。</p>
<p><strong>7. Tweener.removeAllTweens():Boolean;</strong></p>
<p>移除<strong>所有</strong>進行中的tweening</p>
<p><strong>8. Tweener.removeTweens(target:Object, [, property1:String, property2:String, ...]):Boolean;</strong></p>
<p>移除一個object所有或其中一些屬性的tweening。</p>
<p><strong>9. Tweener.setTimeScale(scale:Number);</strong></p>
<p>用來改變Tweener的時間速度。如scale是2，則原本是1秒的tweening會在0.5秒完成，即是快了一倍。</p>
<p>想了解Tweener詳細的API，請到:<br />
<a title="Tweener Documentation" href="http://hosted.zeh.com.br/tweener/docs/en-us/">http://hosted.zeh.com.br/tweener/docs/en-us/</a></p>
<p>&gt;&gt; <a title="Lesson 4: Tweener 10大用途" href="http://blog.frogiology.com/2008/09/07/flash-tweener-lesson3-10-usages/">Lesson 4: Tweener 10大用途</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.frogiology.com/2008/08/31/flash-tweener-lesson3-syntax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>介紹 Tweener</title>
		<link>http://blog.frogiology.com/2008/08/29/flash-tweener-lesson2-introduction/</link>
		<comments>http://blog.frogiology.com/2008/08/29/flash-tweener-lesson2-introduction/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 13:49:48 +0000</pubDate>
		<dc:creator>Stanley Fok</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[tweener]]></category>

		<guid isPermaLink="false">http://blog.frogiology.com/?p=127</guid>
		<description><![CDATA[當Tweener還未出現的時候 當我還小的時間，曾看過電腦雜誌的Flash教學，見過有人教用以下的formula做到easing的效果: 在EnterFrame的event中﹕ myMc.x += (targetX – myMc.x) / FACTOR; //targetX 是目標的X座標 //FACTOR是一個constant，數字愈大，easing的時間愈長 可是這個方法有很多缺點: 只做到減速效果 tweening時間不能控制 令program更複雜 但當有人寫了Tweener這些tweening engine後，問題已不再存在了! 甚麼是Tweener Tweener 是一個 open source 的 tweening engine(即是一系例的class)，其主要功用就是可以利用actionscript動態地tween movieclip 的屬性，如x, y, scaleX, scaleY, alpha, width, height 等等。除此之外，你也可以用Tweener來tween object的屬性，如sound object的volume，textfield的座標，甚至是3D camera的位置等等，用途多不勝數。在之後的章節Stanley會介紹一些應用的例子。 大家都應該知道我們也可以用timeline制作transiton，但是用timeline卻有很大的限制: timeline即是hardcode的，對於制作很具互動性的RIA根本是沒可能 timeline是frame-based的，即是如果timeline很複雜，Flash亦要每一個frame都畫出來，慢的電腦就會很不流暢，即是說播放時間不易控制 timeline會令你的movieclip結更複雜 但是用Tweener，情況就恰好相反了: Tweener可以讓你動態地建立transition Tweener是time-based的，比如說你建立了2秒的transition，無論是快或慢的電腦都可以2秒完成 Tweener是幫助你簡化movieclip的結構 總之，Tweener是一個可幫助你製作高互動性，流暢animation RIA不可或缺的工具。 Transition 的類型 Tweener的靈魂，就是它提供的transition types。Transition types是用來定義一個數值，是用甚麼的方法轉變到另一個目標數值，例如選用quadratic或是exponential的方式轉變。而物件移動或淡出淡入時都可以利用transition types建立easing，因而產生流暢的感覺。 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>當Tweener還未出現的時候</strong></p>
<p>當我還小的時間，曾看過電腦雜誌的Flash教學，見過有人教用以下的formula做到easing的效果:</p>
<p>在EnterFrame的event中﹕</p>
<pre><code>myMc.x += (targetX – myMc.x) / FACTOR;
<span style="color: #008000;">//targetX 是目標的X座標
//FACTOR是一個constant，數字愈大，easing的時間愈長</span></code></pre>
<p>可是這個方法有很多缺點:</p>
<ul>
<li>只做到減速效果</li>
<li>tweening時間不能控制</li>
<li>令program更複雜</li>
</ul>
<p>但當有人寫了Tweener這些tweening engine後，問題已不再存在了!</p>
<p><span id="more-127"></span></p>
<p><strong>甚麼是Tweener</strong></p>
<p><a title="Tweener" href="http://code.google.com/p/tweener/" target="_blank">Tweener</a> 是一個 open source 的 tweening engine(即是一系例的class)，其主要功用就是可以利用actionscript動態地tween movieclip 的屬性，如x, y, scaleX, scaleY, alpha, width, height 等等。除此之外，你也可以用Tweener來tween object的屬性，如sound object的volume，textfield的座標，甚至是3D camera的位置等等，用途多不勝數。在之後的章節Stanley會介紹一些應用的例子。</p>
<p>大家都應該知道我們也可以用timeline制作transiton，但是用timeline卻有很大的限制:</p>
<ul>
<li>timeline即是hardcode的，對於制作很具互動性的RIA根本是沒可能</li>
<li>timeline是frame-based的，即是如果timeline很複雜，Flash亦要每一個frame都畫出來，慢的電腦就會很不流暢，即是說播放時間不易控制</li>
<li>timeline會令你的movieclip結更複雜</li>
</ul>
<p>但是用Tweener，情況就恰好相反了:</p>
<ul>
<li>Tweener可以讓你動態地建立transition</li>
<li>Tweener是time-based的，比如說你建立了2秒的transition，無論是快或慢的電腦都可以2秒完成</li>
<li>Tweener是幫助你簡化movieclip的結構</li>
</ul>
<p>總之，Tweener是一個可幫助你製作高互動性，流暢animation RIA不可或缺的工具。</p>
<p><strong>Transition 的類型</strong></p>
<p>Tweener的靈魂，就是它提供的transition types。Transition types是用來定義一個數值，是用甚麼的方法轉變到另一個目標數值，例如選用quadratic或是exponential的方式轉變。而物件移動或淡出淡入時都可以利用transition types建立easing，因而產生流暢的感覺。</p>
<p>下表就是Tweener提供的所有transition types:</p>
<div id="attachment_128" class="wp-caption alignnone" style="width: 310px"><a href="http://blog.frogiology.com/wp-content/uploads/2008/08/tweener-transition-types.jpg" rel="lightbox[127]"><img class="size-medium wp-image-128" title="Tweener 提供的transition types" src="http://blog.frogiology.com/wp-content/uploads/2008/08/tweener-transition-types-300x222.jpg" alt="Tweener 提供的transition types" width="300" height="222" /></a><p class="wp-caption-text">Tweener 提供的transition types</p></div>
<p>詳情可以看 Tweener的文件:<br />
<a href="http://hosted.zeh.com.br/tweener/docs/en-us/misc/transitions.html">http://hosted.zeh.com.br/tweener/docs/en-us/misc/transitions.html</a></p>
<p>* 其實這些Tweening forumula是由一位叫Robert Penner所創立的，有興趣可以看看他的網頁。他可是一位非常利害的人呢!<br />
<a href="http://robertpenner.com/">http://robertpenner.com/</a></p>
<p><strong>比較其他Tweening Engine</strong></p>
<p>其實除了Tweener外，還有很多其他的engine，如:</p>
<ul>
<li>TweenLite</li>
<li>Boostworthy Animation System</li>
<li>FuseKit</li>
<li>Go</li>
<li>KitchenSync</li>
</ul>
<p>這些engine都各有特性，如果有興趣，可以看看它們的pros and cons呢。<br />
<a href="http://dispatchevent.org/wp-content/uploads/2008/04/Tween-Engine-Comparisons.pdf">http://dispatchevent.org/wp-content/uploads/2008/04/Tween-Engine-Comparisons.pdf</a></p>
<p>&gt;&gt; <a title="Lesson 3: Tweener 語法實習" href="http://blog.frogiology.com/2008/08/31/flash-tweener-lesson3-syntax/">Lesson 3: Tweener 語法實習</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.frogiology.com/2008/08/29/flash-tweener-lesson2-introduction/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

