09.04.2016 Views

www.ebook777.com

Make_Getting_Started_with_Processing_Second_Edition

Make_Getting_Started_with_Processing_Second_Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Robot 5: Media<br />

Unlike the robots created from lines and rectangles drawn in<br />

Processing in the previous chapters, these robots were created<br />

with a vector drawing program. For some shapes, it’s often easier<br />

to point and click in a software tool like Inkscape or Illustrator<br />

than to define the shapes with coordinates in code.<br />

There’s a trade-off to selecting one image creation technique<br />

over another. When shapes are defined in Processing, there’s<br />

more flexibility to modify them while the program is running. If<br />

the shapes are defined elsewhere and then loaded into Processing,<br />

changes are limited to the position, angle, and size. When<br />

loading each robot from an SVG file, as this example shows, the<br />

variations featured in Robot 2 (see “Robot 2: Variables” on page<br />

47) are impossible.<br />

Images can be loaded into a program to bring in visuals created<br />

in other programs or captured with a camera. With this image in<br />

the background, our robots are now exploring for life-forms in<br />

Norway at the dawn of the 20th century.<br />

The SVG and PNG files used in this example can be downloaded<br />

from http://<strong>www</strong>.processing.org/learning/books/media.zip:<br />

Media 101

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

Saved successfully!

Ooh no, something went wrong!