說明動畫Flash Player 9 以及更新的版本,Adobe AIR 1.0 以及更新的版本,需要 Flash CS3 或更新的版本 MotionBase 類別的 addPropertyArray() 方法可用於加入值的陣列,以說明每個補間屬性。 對於移動補間動畫中的每個關鍵影格,這個陣列可能包含一個陣列項目。這些陣列的其中幾個陣列所包含的項目往往少於移動補間動畫中關鍵影格的總數。當陣列中的最後一個值不會針對剩餘的影格進行變更時,就會發生這種情形。 如果陣列引數的長度大於 Motion 物件的 duration 屬性時,addPropertyArray() 就會根據陣列引數的長度調整 duration 屬性的值,而不會針對之前已加入的屬性增加關鍵影格。對於多出來的動畫影格,新加入的關鍵影格則會繼續存在。 執行動畫時,Motion 物件的 x 和 y 屬性會描述補間動畫物件所變更的位置。如果在每個關鍵影格中,顯示物件的位置都有變更,那麼這些座標就是每個關鍵影格中都會變更的值。您可以使用 addPropertyArray() 方法,加入其它移動屬性。例如,如果要重新調整補間動畫物件的大小,請加入 scaleX 和 scaleY 屬性並設定其值;如果要傾斜補間動畫物件,請加入 skewX 和 skewY 屬性並設定其值;如果要旋轉補間動畫物件,請加入 rotationConcat 屬性並設定其值。 您可以使用 addPropertyArray() 方法,定義下列補間動畫屬性:
視您在 Flash 中指定給移動補間動畫哪些屬性,加入至自動產生之指令碼的屬性將有所不同。自訂專屬的指令碼時,您可以新增、移除或修改上述某些屬性。 下列程式碼會將幾個值指定給名為 __motion_Wheel 之移動補間動畫的屬性。在這個範例中,補間動畫顯示物件的位置不會改變,但會在補間動畫的整個 29 個影格中原地打轉。指定給 rotationConcat 陣列的多個值會定義旋轉的方式,這個移動補間動畫的其它屬性值則不會改變。 __motion_Wheel = new Motion(); __motion_Wheel.duration = 29; __motion_Wheel.addPropertyArray("x", [0]); __motion_Wheel.addPropertyArray("y", [0]); __motion_Wheel.addPropertyArray("scaleX", [1.00]); __motion_Wheel.addPropertyArray("scaleY", [1.00]); __motion_Wheel.addPropertyArray("skewX", [0]); __motion_Wheel.addPropertyArray("skewY", [0]); __motion_Wheel.addPropertyArray("rotationConcat", [ 0,-13.2143,-26.4285,-39.6428,-52.8571,-66.0714,-79.2857,-92.4999,-105.714, -118.929,-132.143,-145.357,-158.571,-171.786,-185,-198.214,-211.429,-224.643, -237.857,-251.071,-264.286,-277.5,-290.714,-303.929,-317.143,-330.357, -343.571,-356.786,-370 ] ); __motion_Wheel.addPropertyArray("blendMode", ["normal"]); 在下個範例中,名為 Leaf_1 的顯示物件會移動橫越舞台。針對動畫所包含之 100 個影格的其中每一個影格,這個顯示物件的 x 和 y 屬性陣列都包含不同的值。此外,當物件移動橫越舞台時,會在其 z 軸上旋轉。rotationZ 屬性陣列中的多個項目會決定轉動的方式。 __motion_Leaf_1 = new MotionBase(); __motion_Leaf_1.duration = 100; __motion_Symbol1_4.addPropertyArray("y", [ 0,5.91999,11.84,17.76,23.68,29.6,35.52,41.44,47.36,53.28,59.2,65.12,71.04, 76.96,82.88,88.8,94.72,100.64,106.56,112.48,118.4,124.32,130.24,136.16,142.08, 148,150.455,152.909,155.364,157.818,160.273,162.727,165.182,167.636,170.091, 172.545,175,177.455,179.909,182.364,184.818,187.273,189.727,192.182,194.636, 197.091,199.545,202,207.433,212.865,218.298,223.73,229.163,234.596,240.028, 245.461,250.893,256.326,261.759,267.191,272.624,278.057,283.489, 288.922,294.354,299.787,305.22,310.652,316.085,321.517,326.95,330.475,334, 337.525,341.05,344.575,348.1,351.625,355.15,358.675,362.2,365.725,369.25, 372.775,376.3,379.825,383.35,386.875,390.4,393.925,397.45,400.975,404.5, 407.5,410.5,413.5,416.5,419.5,422.5,425.5 ] ); __motion_Symbol1_4.addPropertyArray("scaleX", [1.00]); __motion_Symbol1_4.addPropertyArray("scaleY", [1.00]); __motion_Symbol1_4.addPropertyArray("skewX", [0]); __motion_Symbol1_4.addPropertyArray("skewY", [0]); __motion_Symbol1_4.addPropertyArray("z", [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] ); __motion_Symbol1_4.addPropertyArray("rotationX", [64.0361]); __motion_Symbol1_4.addPropertyArray("rotationY", [41.9578]); __motion_Symbol1_4.addPropertyArray("rotationZ", [ -18.0336,-17.5536,-17.0736,-16.5936,-16.1136,-15.6336,-15.1536,-14.6736, -14.1936,-13.7136,-13.2336,-12.7536,-12.2736,-11.7936,-11.3136,-10.8336, -10.3536,-9.8736,-9.3936,-8.9136,-8.4336,-7.9536,-7.4736,-6.9936,-6.5136, -6.0336,-7.21542,-8.39723,-9.57905,-10.7609,-11.9427,-13.1245,-14.3063, -15.4881,-16.67,-17.8518,-19.0336,-20.2154,-21.3972,-22.5791,-23.7609, -24.9427,-26.1245,-27.3063,-28.4881,-29.67,-30.8518,-32.0336,-31.0771, -30.1206,-29.164,-28.2075,-27.251,-26.2945,-25.338,-24.3814,-23.4249, -22.4684,-21.5119,-20.5553,-19.5988,-18.6423,-17.6858,-16.7293,-15.7727 -14.8162,-13.8597,-12.9032,-11.9466,-10.9901,-10.0336,-10.9427,-11.8518, -12.7609,-13.67,-14.5791,-15.4881,-16.3972,-17.3063,-18.2154,-19.1245, -20.0336,-20.9427,-21.8518,-22.7609,-23.67,-24.5791,-25.4881,-26.3972, -27.3063,-28.2154,-29.1245,-30.0336,-28.3193,-26.605,-24.8907,-23.1765, -21.4622,-19.7479,-18.0336 ] ); __motion_Symbol1_4.addPropertyArray("blendMode", ["normal"]); |
|