tailieunhanh - Học Actionscript 3.0 - p 24
The Geometry Package For example, combinations of elements, such as scale and rotation, can be applied at once, and matrices can even be used to achieve effects that are otherwise not possible with individual properties, such as skewing. You can also use matrices for more advanced operations such as determining where a point ends up after an object has been transformed. In other words, the point (10, 10) near the upper-left corner of a rectangle will not be at point (10, 10) after a 90-degree rotation. The Matrix class can tell you the new location to which that point has moved,. | The Geometry Package For example combinations of elements such as scale and rotation can be applied at once and matrices can even be used to achieve effects that are otherwise not possible with individual properties such as skewing. You can also use matrices for more advanced operations such as determining where a point ends up after an object has been transformed. In other words the point 10 10 near the upper-left corner of a rectangle will not be at point 10 10 after a 90-degree rotation. The Matrix class can tell you the new location to which that point has moved or even the change in location between the new and original points. The Matrix class provides a basic 3 x 3 matrix for use in several transformation processes. Its structure can be seen in Figure 8-15. Built-in Matrix properties a and d affect scaling. Properties b and c will skew or shear an object. The tx and ty properties affect x and y location respectively. Together elements a b c and d affect rotation. The last three values in the matrix u v and w are not used in ActionScript and can be ignored. Table 8-1 shows the transformations possible with a matrix. The first column shows the type of transformation the second column lists related properties and a simplified class method for accomplishing the goal if one exists and the third column shows the values that must be adjusted if you need to do so manually. It is almost always more convenient to use existing methods or the a b c d tx and ty proper ties but writing out the matrix explicitly is useful when you want to make several changes at once. Finally the last column depicts a representative change in an object when the transformation is applied. a c tx b d ty u v w Figure 8-15. Matrix properties Table 8-1. Matrix values and how they transform objects Transformation Properties Methods Matrix Identity Default matrix null transformation a b c d tx ty identity 1 0 0 0 1 0 0 0 1 Translation Changes position x and y respectively using pixels tx ty .
đang nạp các trang xem trước