jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of jQuery 1.4 Animation Techniques - Index of

02.06.2013 Views

In the previous screenshot we can see that the element is now twice its original size. [ 235 ] Chapter 9 The previous code symmetrically scales the target element along both the x and y axes. These values are unit-less in all supporting browsers, and the value 0 cannot be specified. Integers or floating-point numbers may be provided, and the scaling may be asymmetrical if necessary. An interesting effect of scaling is that providing negative values cause the element to be reversed, and not shrunk, as we may intuitively surmise. So if we were to provide -2 and -2 as the first and fourth values in the previous code-snippet, the element would be reflected both vertically and horizontally, as well as being made twice its original size. We can even supply a combination of positive and negative values for this type of transformation. A reflected element would appear like this: The element is reversed along both its x and y axes, as if it were being viewed upside down in a mirror. This could be hugely useful if, for example, we were implementing pure-CSS reflections.

CSS3 Animations Skew Remember the two zero values that correspond to parameters 2 and 3? These can be used as skew values, with the x axis using the second parameter, and the y axis using the third. We could skew an element (without modifying its scale or position) using the following matrix transform function: transform: matrix(1, 1, 0, 1, 0, 0); The following screenshot shows a skewed element: The previous screenshot shows an element skewed along the x axis. As with other matrix functions, positive values for these parameters cause transformation along the right or downwards direction, negative values along the left or up directions. In the previous snippet, only the x axis has been skewed. A consequence of the skew is that the element has grown in size. The bounding box of the transformed element has doubled in size from 200 px (the original size of the element) to 400 px. Regardless of this increase in size however, the flow of the document remains unaffected by the transform, and just like the other transforms, any content within the transformed element also becomes transformed. Text appearance Transforms have a varying impact on any text contained in the element across different browsers, with the text remaining crisp and readable in some browsers following a transform, and degrading in other browsers. [ 236 ]

CSS3 <strong>Animation</strong>s<br />

Skew<br />

Remember the two zero values that correspond to parameters 2 and 3? These can be used<br />

as skew values, with the x axis using the second parameter, and the y axis using the third.<br />

We could skew an element (without modifying its scale or position) using the following<br />

matrix transform function:<br />

transform: matrix(1, 1, 0, 1, 0, 0);<br />

The following screenshot shows a skewed element:<br />

The previous screenshot shows an element skewed along the x axis. As with other matrix<br />

functions, positive values for these parameters cause transformation along the right or<br />

downwards direction, negative values along the left or up directions.<br />

In the previous snippet, only the x axis has been skewed. A consequence <strong>of</strong> the skew is that<br />

the element has grown in size. The bounding box <strong>of</strong> the transformed element has doubled<br />

in size from 200 px (the original size <strong>of</strong> the element) to 400 px.<br />

Regardless <strong>of</strong> this increase in size however, the flow <strong>of</strong> the document remains unaffected<br />

by the transform, and just like the other transforms, any content within the transformed<br />

element also becomes transformed.<br />

Text appearance<br />

Transforms have a varying impact on any text contained in the element<br />

across different browsers, with the text remaining crisp and readable in<br />

some browsers following a transform, and degrading in other browsers.<br />

[ 236 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!