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.

The properties we can set on text include:<br />

Property Usage<br />

font Sets the size and the font-family <strong>of</strong> the text.<br />

[ 271 ]<br />

Chapter 10<br />

textAlign Sets the alignment <strong>of</strong> the text. Can be either start (the default),<br />

end, left, right, or center.<br />

textBaseline Sets the baseline <strong>of</strong> the text. Can be either alphabetic (the<br />

default), top, hanging, middle, ideographic, or bottom.<br />

Transformation methods<br />

The can have the same transforms applied to it that we saw in the last chapter,<br />

which can be applied using the following methods:<br />

Method Usage<br />

rotate(a) Rotates a shape by the specified number <strong>of</strong> radians.<br />

scale(a, b) Scales a shape along each axis by the specified amount, with<br />

a being the x axis and b the y axis.<br />

translate(a, b) Translates the shape along each axis by the specified amount,<br />

with a being the x axis and b the y axis.<br />

transform(a, b, c, d, e, f) The transform() method is equivalent to the matrix<br />

transform form function and can be used in the same way to<br />

scale, translate, and/or skew the shape.<br />

Pixel manipulation<br />

The even allows us to work directly with the pixels in the canvas and can retrieve<br />

shapes as imageData objects, or create shapes directly by manipulating the at<br />

pixel-level. We have the following methods for manipulating pixels:<br />

Method Usage<br />

createImageData(a, b) Creates a new, blank imageData object using the supplied<br />

arguments as width and height properties. This method can also be<br />

passed another imageData object, which will cause the method<br />

to return an (empty) imageData object the same width and<br />

height as the original.<br />

getImageData(a, b, c, d) Returns an imageData object containing the pixel data for the<br />

specified area <strong>of</strong> the . Arguments a and b are the start<br />

coordinates <strong>of</strong> the area, c and d are the width and height.<br />

putImageData(a, b, c) Paints the pixel data to the . The first argument is the<br />

imageData object to use, the second and third are the start<br />

coordinates <strong>of</strong> the resulting shape.

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

Saved successfully!

Ooh no, something went wrong!