シェイプモーフィング - hsk/swfspec_ja GitHub Wiki
シェイプモーフィング 目次
Shape morphing is the metamorphosis of one shape into another over time. The SWF file format specification supports a flexible morphing model, which allows a number of shape attributes to vary during the morph. The SWF file format defines only the start and end states of the morph. Adobe Flash Player is responsible for interpolating between the endpoints and generating the ‘in-between’ states.
The following shape attributes can be varied during the morph:
- The position of each edge in the shape.
- The color and thickness of the outline.
- The fill color of the shape (if filled with a color).
- The bitmap transform (if filled with a bitmap).
- The gradient transform (if filled with a gradient).
- The color and position of each point in the gradient (if filled with a gradient).
The following restrictions apply to morphing:
- The start and end shapes must have the same number of edges.
- The start and end shapes must have the same type of fill (that is, solid, gradient or bitmap).
- The style change records must be the same for the start and end shapes.
- If filled with a bitmap, both shapes must be filled with the same bitmap.
- If filled with a gradient, both gradients must have the same number of color points.
The following illustration shows a morph from a blue rectangle to a red quadrilateral over five frames. The green outlines represent the ‘in-between’ shapes of the morph sequence. Both shapes have the same number of points, and the same type of fill, namely a solid fill. Besides changing shape, the shape also gradually changes color from blue to red.

There are two tags involved in defining and playing a morph sequence:
- DefineMorphShape
- PlaceObject2
DefineMorphShape defines the start and end states of the morph. A morph object does not use previously defined shapes; it is considered a special type of shape with only one character ID. DefineMorphShape contains a list of edges for both the start and end shapes. It also defines the fill and line styles, as they are at the start and end of the morph sequence. The PlaceObject 2 tag displays the morph object at some point in time during the morph sequence. The ratio field controls how far the morph has progressed. A ratio of zero produces a shape identical to the start condition. A ratio of 65535 produces a shape identical to the end condition.
移動
- 前のページ : DefineBitsJPEG4
- 次のページ : DefineMorphShape