Transform
Move, scale, skew, or rotate a drawable in its parent.
Scale, then skew, then rotate around the local pivot. Translation moves the result along the parent’s axes.
Example
Turn a rectangle around its center
Transform attributes belong to <shape>, <group>, and <sequence>. Here the shape translates to (32, 24) and keys its own rotate attribute. At frame 0 the painted rectangle is 12 × 8. At frame 4 it has turned 90° clockwise and paints an 8 × 12 area. The shape’s default pivot is local (0, 0), the point where the rectangle’s default registration places its center. The center therefore stays at (32, 24) during the turn.
<shape translate-x="32" translate-y="24">
<animate attributeName="rotate" fill="freeze">
<key frame="0" value="0" ease="linear"/>
<key frame="4" value="90"/>
</animate>
<rect width="12" height="8">
<animate attributeName="width" fill="freeze">
<key frame="4" value="12" ease="linear"/>
<key frame="8" value="20"/>
</animate>
</rect>
<fill><paint><solid color="#FFFFFFFF"/></paint></fill>
</shape>Usage context
Trait Transform in the scene format type model.
Related pages in this reference are Drawable.
Attributes
translate-x
Value parent units · If omitted 0 · Keys Scalar
Horizontal translation.
translate-y
Value parent units · If omitted 0 · Keys Scalar
Vertical translation.
pivot-x
Value local units · If omitted 0 · Keys Scalar
Horizontal coordinate of the transform pivot.
pivot-y
Value local units · If omitted 0 · Keys Scalar
Vertical coordinate of the transform pivot.
scale-x
Value factor · If omitted 1 · Keys Scalar
Local horizontal scale. Negative values reflect the axis.
scale-y
Value factor · If omitted 1 · Keys Scalar
Local vertical scale. Negative values reflect the axis.
skew-x
Value degrees · If omitted 0 · Keys Scalar
Horizontal shear angle, strictly between −90 and 90.
rotate
Value degrees · If omitted 0 · Keys Scalar
Rotation about the drawable pivot, clockwise in default scene coordinates.