利用 AS3 建立移動補間動畫範例(fl.motion.easing.Back)

舞台大小設為 550 x 100




在新增一個圖層,命名為程式碼;在第一影格寫入以下程式碼。

import fl.motion.easing.*; // import the easing classes
fl.motion.easing.Back; // add a reference to every easing class you want to use
////
var mc2_xml:XML = <Motion duration="30" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
    <source>
        <Source frameRate="30" x="85.05" y="90.05" scaleX="0.999" scaleY="0.999" rotation="0" elementType="movie clip" instanceName="mc2" symbolName="BoxSymbol" linkageID="Box" class="Box">
            <dimensions>
                <geom:Rectangle left="-39" top="-52" width="77" height="97"/>
            </dimensions>
            <transformationPoint>
                <geom:Point x="0.5019480519480519" y="0.5010309278350515"/>
            </transformationPoint>
        </Source>
    </source>

    <Keyframe index="0">
        <tweens>
            <FunctionEase functionName="fl.motion.easing.Back.easeInOut"/>
        </tweens>
    </Keyframe>

    <Keyframe index="29" x="330" y="0"/>
</Motion>;

var mc2_animator:Animator = new Animator(mc2_xml, mc2);
mc2_animator.play();


匯入一個元件到元件庫,設定為影片片段類型。如左圖

加入一個圖層,並將元件置入此圖層第一影格。如下圖

將此元件實體名稱,命名為 mc2


執行測試,範例測試結果

沒有留言:

張貼留言