04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

PROCESSING: CREATIVE CODING AND COMPUTATIONAL ART<br />

740<br />

Attributes<br />

Figure A-19. Orbiting Text sketch<br />

The Attributes subsection includes five functions, textMode(), textSize(), textAlign(),<br />

textLeading(), <strong>and</strong> textWidth(), which respectively refer to model or screen mode (for<br />

3D), font size, alignment (left, center, or right), leading (the distance between lines of<br />

text), <strong>and</strong> a function for returning the width of a character or text string.<br />

Metrics<br />

The Metrics subsection includes two functions for returning the actual height of a line of<br />

text. textDescent() returns the distance of any descending parts of the fonts below the<br />

baseline, <strong>and</strong> textAscent() does the same for any parts above the baseline. Adding these<br />

two values together gives you the total height of the line.<br />

Math<br />

This section is one of the largest in the API <strong>and</strong> perhaps the scariest one for creative<br />

coders. However, you’ve used large parts of it in this book already, as math is (unavoidably)<br />

the underlying language of coding. Also, many of the functions within this section are<br />

actually designed to simplify the mathematical dem<strong>and</strong>s of programming. So, I’ll cruise<br />

through most of this stuff pretty swiftly. The Math section is divided into the following five<br />

subsections:<br />

Operators<br />

Bitwise Operators<br />

Calculation<br />

Trigonometry<br />

R<strong>and</strong>om

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

Saved successfully!

Ooh no, something went wrong!