Export animation data from flash?

2019-08-07 05:25发布

From Pro Adobe flash can I export an animation's data? Like the x and y coordinates and rotation values for individual images in a sequence.

1条回答
戒情不戒烟
2楼-- · 2019-08-07 05:45

You can right click on a motion-tweened instance, or on a tween in the Timeline, and select Copy Motion as ActionScript 3.0.

Copy Motion as ActionScript 3.0

You'll then have something like this in your clipboard:

import fl.motion.AnimatorFactory;
import fl.motion.MotionBase;
import fl.motion.Motion;
import flash.filters.*;
import flash.geom.Point;
var __motion_Symbol1_2:MotionBase;
if(__motion_Symbol1_2 == null) {
    __motion_Symbol1_2 = new Motion();
    __motion_Symbol1_2.duration = 24;

    // Call overrideTargetTransform to prevent the scale, skew,
    // or rotation values from being made relative to the target
    // object's original transform.
    // __motion_Symbol1_2.overrideTargetTransform();

    // The following calls to addPropertyArray assign data values
    // for each tweened property. There is one value in the Array
    // for every frame in the tween, or fewer if the last value
    // remains the same for the rest of the frames.
    __motion_Symbol1_2.addPropertyArray("x", [0]);
    __motion_Symbol1_2.addPropertyArray("y", [0]);
    __motion_Symbol1_2.addPropertyArray("scaleX", [1.000000]);
    __motion_Symbol1_2.addPropertyArray("scaleY", [1.000000]);
    __motion_Symbol1_2.addPropertyArray("skewX", [0]);
    __motion_Symbol1_2.addPropertyArray("skewY", [0]);
    __motion_Symbol1_2.addPropertyArray("rotationConcat", [0]);
    __motion_Symbol1_2.addPropertyArray("cacheAsBitmap", [false]);

    // Create an AnimatorFactory instance, which will manage
    // targets for its corresponding Motion.
    var __animFactory_Symbol1_2:AnimatorFactory = new AnimatorFactory(__motion_Symbol1_2);
    __animFactory_Symbol1_2.transformationPoint = new Point(0.500000, 0.499773);

    // Call the addTarget function on the AnimatorFactory
    // instance to target a DisplayObject with this Motion.
    // The second parameter is the number of times the animation
    // will play - the default value of 0 means it will loop.
    // __animFactory_Symbol1_2.addTarget(<instance name goes here>, 0);
}
查看更多
登录 后发表回答