Chapter 32. Applying Transformations to Graphics
Introduction
In this chapter
Understanding transforms
Using matrices to rotate, scale, translate, and shear MovieClip objects
Using color transforms
Applying solid colors
Applying tints
The flash.geom.Transform
class lets you apply two sorts of transformations to display objects—geometric and color. A Transform
object has a handful of properties, two of which are matrix
and colorTransform
. The matrix
property is a Matrix
object you can use to apply geometric transforms, as discussed in the section “Working with Matrix Transforms.” The colorTransform
property is a ColorTransform
object you can use to apply color transforms, as discussed in the section “Working with Color Transforms.”
Working with Matrix Transforms
You've already seen how you can transform a display object in basic ways using properties such as x, y, width, height, and so on. However, using matrices you can apply more complex transformations—not only offsetting the coordinates, scaling, or rotating the object, but also skewing/shearing the object.
A matrix is a representation of a set of linear equations. For example, the following equation determines a line in two‐dimensional space:
2x + 10y = 5
That linear equation can be written as the following 1×3 matrix:
| 2 10 5 |
If you have more than one linear equation, you can group each of them into a single matrix. For example, consider the following three linear equations:
2x + 10y = 5 1x + 2y = 8 4x + 1y = 3
The preceding three ...
Get ActionScript™ 3.0 Bible now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.