02.06.2013 Views

jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

For example, we could simply use a PNG with no transparency, which would preserve the<br />

circle's border in IE (in this example). Or, we could lay another image over the top <strong>of</strong> the<br />

image we are rotating to hide the jagged edges.<br />

Pop quiz – implementing CSS3 rotation<br />

[ 247 ]<br />

Chapter 9<br />

1. In this example we used an array in conjunction with the JavaScript join() method<br />

to create the string. Why?<br />

a. Because it's more fun<br />

b. Because it makes our code look better<br />

c. Because performance-wise, it's much faster than string concatenation<br />

d. Because otherwise the element won't rotate correctly<br />

2. To make the animation run correctly in Internet Explorer we had to constantly adjust<br />

the top and left style properties <strong>of</strong> the rotated element in order to maintain its<br />

position. Why does the drift in IE occur?<br />

a. Because the size <strong>of</strong> the rotated element's bounding box is changed<br />

throughout the animation. As the rotated element is centered within its<br />

bounding box, its position changes as the box increases and decreases in size<br />

b. Because the alpha layer <strong>of</strong> the PNG was removed<br />

c. Because the Matrix filter property was used<br />

d. Because <strong>of</strong> a bug in IE's implementation <strong>of</strong> the CSS3 rotate property<br />

Have a go hero – extending CSS3 rotation<br />

The rotation effect can be used in many places, whether animated or not, but when<br />

animated as in this example, it makes a very good background as part <strong>of</strong> a larger composition<br />

<strong>of</strong> elements. Used as the background <strong>of</strong> a semi-transparent logo for example, creates a<br />

stunning effect.<br />

Have a go at incorporating the effect into a page and using it as the background <strong>of</strong> another<br />

image. You'll also see first-hand how much this can improve the appearance <strong>of</strong> the effect<br />

in IE.<br />

Animated skewing<br />

Just like with the rotate() function, we can animate a skew() transform for creating<br />

attractive special effects. In this example, we'll use the matrix() function for all browsers,<br />

not just IE, in order to apply several transforms to an element at once.

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

Saved successfully!

Ooh no, something went wrong!