UNPKG

epubjs

Version:

Render ePub documents in the browser, across many devices

2,828 lines (302 loc) 40.1 kB
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta charset="utf-8"/> <title>Getting Started with Processing</title> <script type="text/javascript"> if(!window.atlasplugins) window.atlasplugins = {} atlasplugins.codeMirrorSettings = { theme: "3024-day" } </script> <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css"> </link> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script> <link rel="stylesheet" type="text/css" href="theme/html/html.css"/> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/codemirror.min.css"/> <link rel="stylesheet" type="text/css" href="https://d2uogd9jz9k9zm.cloudfront.net/processingjs-0.0.3.css"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/codemirror.min.js" type="text/javascript"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.5.0/mode/clike/clike.min.js" type="text/javascript"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js" type="text/javascript"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.8/processing.min.js" type="text/javascript"> </script> <script src="https://d2uogd9jz9k9zm.cloudfront.net/processingjs-0.0.3.min.js" type="text/javascript"> </script> <script type="text/javascript"> $(function() { // Make all non runnable examples readonly codemirrors $('pre:not(*[data-executable], .CodeMirror pre)').each(function(i, el) { var textArea = $('<textarea>' + el.innerHTML + '</textarea>') $(el).replaceWith(textArea); var editor = CodeMirror.fromTextArea(textArea[0], { mode: "text/x-java", theme: "3024-day", readOnly: true, viewportMargin: 0 }); }); }); </script> <style type="text/css"> /* This needs to come last to set auto height, and html.css is always included first */ .CodeMirror { height: auto; font-size: 14px; padding: 15px; border-radius: 5px; } .CodeMirror-scroll { overflow-y: hidden; overflow-x: auto; height: auto; } </style> <script type="text/javascript" src="theme/html/epub.js"> </script> <script type="text/javascript" src="theme/html/reader.js"> </script> </head> <body data-type="book" id="viewer"> <nav data-type="toc" id="idp1629168"><ol><li data-type="preface"><a href="preface01.html#preface">Preface</a><ol> <li data-type="sect1"><a href="preface01.html#how_this_book_is_organized">How This Book Is Organized</a></li> <li data-type="sect1"><a href="preface01.html#who_this_book_is_for">Who This Book Is For</a></li> <li data-type="sect1"><a href="preface01.html#conventions_used_in_this_book">Conventions Used in This Book</a></li> <li data-type="sect1"><a href="preface01.html#using_code_examples">Using Code Examples</a></li> <li data-type="sect1"><a href="preface01.html#how_to_contact_us">How to Contact Us</a></li> <li data-type="sect1"><a href="preface01.html#safarir_books_online">Safari® Books Online</a></li> <li data-type="sect1"><a href="preface01.html#acknowledgments">Acknowledgments</a></li> </ol></li><li data-type="chapter"><a href="ch01.html#hello">Hello</a><ol> <li data-type="sect1"><a href="ch01.html#sketching_and_prototyping">Sketching and Prototyping</a></li> <li data-type="sect1"><a href="ch01.html#flexibility">Flexibility</a></li> <li data-type="sect1"><a href="ch01.html#giants">Giants</a></li> <li data-type="sect1"><a href="ch01.html#family_tree">Family Tree</a></li> <li data-type="sect1"><a href="ch01.html#join_in">Join In</a></li> </ol></li><li data-type="chapter"><a href="ch02.html#starting_to_code">Starting to Code</a><ol> <li data-type="sect1"><a href="ch02.html#your_first_program">Your First Program</a><ol> <li data-type="sect2"><a href="ch02.html#example_2-1_colon_draw_an_ellipse"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_02_01">Example 2-1: Draw an Ellipse</a></a></li> <li data-type="sect2"><a href="ch02.html#example_2-2_colon_make_circles"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_02_02">Example 2-2: Make Circles</a></a></li> </ol></li> <li data-type="sect1"><a href="ch02.html#show">Show</a></li> <li data-type="sect1"><a href="ch02.html#save">Save</a></li> <li data-type="sect1"><a href="ch02.html#share">Share</a></li> <li data-type="sect1"><a href="ch02.html#examples_and_reference">Examples and Reference</a></li> </ol></li><li data-type="chapter"><a href="ch03.html#draw">Draw</a><ol> <li data-type="sect1"><a href="ch03.html#example_3-1_colon_draw_a_window">PROD: Insert Section Title Here</a><ol> <li data-type="sect2"><a href="ch03.html#example_3-1_colon_draw_a_window-id1"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_01">Example 3-1: Draw a Window</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-2_colon_draw_a_point"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_02">Example 3-2: Draw a Point</a></a></li> </ol></li> <li data-type="sect1"><a href="ch03.html#basic_shapes">Basic Shapes</a><ol> <li data-type="sect2"><a href="ch03.html#example_3-3_colon_draw_a_line"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_03">Example 3-3: Draw a Line</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-4_colon_draw_basic_shapes"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_04">Example 3-4: Draw Basic Shapes</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-5_colon_draw_a_rectangle"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_05">Example 3-5: Draw a Rectangle</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-6_colon_draw_an_ellipse"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_06">Example 3-6: Draw an Ellipse</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-7_colon_draw_part_of_an_ellips"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_07">Example 3-7: Draw Part of an Ellipse</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-8_colon_draw_with_degrees"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_08">Example 3-8: Draw with Degrees</a></a></li> </ol></li> <li data-type="sect1"><a href="ch03.html#drawing_order">Drawing Order</a><ol> <li data-type="sect2"><a href="ch03.html#example_3-9_colon_control_your_drawing_o"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_09">Example 3-9: Control Your Drawing Order</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-10_colon_put_it_in_reverse"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_10">Example 3-10: Put It in Reverse</a></a></li> </ol></li> <li data-type="sect1"><a href="ch03.html#shape_properties">Shape Properties</a><ol> <li data-type="sect2"><a href="ch03.html#example_3-11_colon_draw_smooth_lines"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_11">Example 3-11: Draw Smooth Lines</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-12_colon_set_stroke_weight"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_12">Example 3-12: Set Stroke Weight</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-13_colon_set_stroke_attributes"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_13">Example 3-13: Set Stroke Attributes</a></a></li> </ol></li> <li data-type="sect1"><a href="ch03.html#color">Color</a><ol> <li data-type="sect2"><a href="ch03.html#example_3-14_colon_paint_with_grays"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_14">Example 3-14: Paint with Grays</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-15_colon_control_fill_and_stro"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_15">Example 3-15: Control Fill and Stroke</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-16_colon_draw_with_color"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_16">Example 3-16: Draw with Color</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-17_colon_set_transparency"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_17">Example 3-17: Set Transparency</a></a></li> </ol></li> <li data-type="sect1"><a href="ch03.html#custom_shapes">Custom Shapes</a><ol> <li data-type="sect2"><a href="ch03.html#example_3-18_colon_draw_an_arrow"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_18">Example 3-18: Draw an Arrow</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-19_colon_close_the_gap"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_19">Example 3-19: Close the Gap</a></a></li> <li data-type="sect2"><a href="ch03.html#example_3-20_colon_create_some_creatures"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_03_20">Example 3-20: Create Some Creatures</a></a></li> </ol></li> <li data-type="sect1"><a href="ch03.html#comments">Comments</a></li> <li data-type="sect1"><a href="ch03.html#robot_1_colon_draw"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Robot1_Draw">Robot 1: Draw</a></a></li> </ol></li><li data-type="chapter"><a href="ch04.html#variables">Variables</a><ol> <li data-type="sect1"><a href="ch04.html#example_4-1_colon_reuse_the_same">PROD: Insert Section Title Here</a><ol> <li data-type="sect2"><a href="ch04.html#example_4-1_colon_reuse_the_same-id1"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_01">Example 4-1: Reuse the Same Values</a></a></li> <li data-type="sect2"><a href="ch04.html#example_4-2_colon_change_values"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_02">Example 4-2: Change Values</a></a></li> </ol></li> <li data-type="sect1"><a href="ch04.html#making_variables">Making Variables</a></li> <li data-type="sect1"><a href="ch04.html#processing_variables">Processing Variables</a><ol> <li data-type="sect2"><a href="ch04.html#example_4-3_colon_adjust_the_size_comma"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_03">Example 4-3: Adjust the Size, See What Follows</a></a></li> </ol></li> <li data-type="sect1"><a href="ch04.html#a_little_math">A Little Math</a><ol> <li data-type="sect2"><a href="ch04.html#example_4-4_colon_basic_arithmetic"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_04">Example 4-4: Basic Arithmetic</a></a></li> </ol></li> <li data-type="sect1"><a href="ch04.html#repetition">Repetition</a><ol> <li data-type="sect2"><a href="ch04.html#example_4-5_colon_do_the_same_thing_over"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_05">Example 4-5: Do the Same Thing Over and Over</a></a></li> <li data-type="sect2"><a href="ch04.html#example_4-6_colon_use_a_for_loop"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_06">Example 4-6: Use a <em>for</em> Loop</a></a></li> <li data-type="sect2"><a href="ch04.html#example_4-7_colon_flex_your_for_loop_apo"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_07">Example 4-7: Flex Your <em>for</em> Loop’s Muscles</a></a></li> <li data-type="sect2"><a href="ch04.html#example_4-8_colon_fanning_out_the_lines"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_08">Example 4-8: Fanning Out the Lines</a></a></li> <li data-type="sect2"><a href="ch04.html#example_4-9_colon_kinking_the_lines"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_09">Example 4-9: Kinking the Lines</a></a></li> <li data-type="sect2"><a href="ch04.html#example_4-10_colon_embed_one_for_loop_in"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_10">Example 4-10: Embed One <em>for</em> Loop in Another</a></a></li> <li data-type="sect2"><a href="ch04.html#example_4-11_colon_rows_and_columns"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_11">Example 4-11: Rows and Columns</a></a></li> <li data-type="sect2"><a href="ch04.html#example_4-12_colon_pins_and_lines"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_12">Example 4-12: Pins and Lines</a></a></li> <li data-type="sect2"><a href="ch04.html#example_4-13_colon_halftone_dots"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_04_13">Example 4-13: Halftone Dots</a></a></li> </ol></li> <li data-type="sect1"><a href="ch04.html#robot_2_colon_variables"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Robot2_Variables">Robot 2: Variables</a></a></li> </ol></li><li data-type="chapter"><a href="ch05.html#response">Response</a><ol> <li data-type="sect1"><a href="ch05.html#_prod_insert_section_title_here">PROD: Insert Section Title Here</a><ol> <li data-type="sect2"><a href="ch05.html#example_5-1_colon_the_draw_open-id1"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_01">Example 5-1: The <em>draw()</em> Function</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-2_colon_the_setup_open_parenth"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_02">Example 5-2: The <em>setup()</em> Function</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-3_colon_setup_open_parenthesis"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_03">Example 5-3: <em>setup()</em>, Meet <em>draw()</em></a></a></li> </ol></li> <li data-type="sect1"><a href="ch05.html#follow">Follow</a><ol> <li data-type="sect2"><a href="ch05.html#example_5-4_colon_track_the_mouse"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_04">Example 5-4: Track the Mouse</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-5_colon_the_dot_follows_you"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_05">Example 5-5: The Dot Follows You</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-6_colon_draw_continuously"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_06">Example 5-6: Draw Continuously</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-7_colon_set_thickness_on_the_f"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_07">Example 5-7: Set Thickness on the Fly</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-8_colon_easing_does_it"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_08">Example 5-8: Easing Does It</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-9_colon_smooth_lines_with_easi"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_09">Example 5-9: Smooth Lines with Easing</a></a></li> </ol></li> <li data-type="sect1"><a href="ch05.html#map">Map</a><ol> <li data-type="sect2"><a href="ch05.html#example_5-10_colon_map_values_to_a_range"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_10">Example 5-10: Map Values to a Range</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-11_colon_map_with_the_map_open"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_11">Example 5-11: Map with the <em>map()</em> Function</a></a></li> </ol></li> <li data-type="sect1"><a href="ch05.html#click">Click</a><ol> <li data-type="sect2"><a href="ch05.html#example_5-12_colon_click_the_mouse"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_12">Example 5-12: Click the Mouse</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-13_colon_detect_when_not_click"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_13">Example 5-13: Detect When Not Clicked</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-14_colon_multiple_mouse_button"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_14">Example 5-14: Multiple Mouse Buttons</a></a></li> </ol></li> <li data-type="sect1"><a href="ch05.html#location">Location</a><ol> <li data-type="sect2"><a href="ch05.html#example_5-15_colon_find_the_cursor"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_15">Example 5-15: Find the Cursor</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-16_colon_the_bounds_of_a_circl"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_16">Example 5-16: The Bounds of a Circle</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-17_colon_the_bounds_of_a_recta"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_17">Example 5-17: The Bounds of a Rectangle</a></a></li> </ol></li> <li data-type="sect1"><a href="ch05.html#type">Type</a><ol> <li data-type="sect2"><a href="ch05.html#example_5-18_colon_tap_a_key"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_18">Example 5-18: Tap a Key</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-19_colon_draw_some_letters"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_19">Example 5-19: Draw Some Letters</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-20_colon_check_for_specific_ke"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_20">Example 5-20: Check for Specific Keys</a></a></li> <li data-type="sect2"><a href="ch05.html#example_5-21_colon_move_with_arrow_keys"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_05_21">Example 5-21: Move with Arrow Keys</a></a></li> </ol></li> <li data-type="sect1"><a href="ch05.html#robot_3_colon_response"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Robot3_Response">Robot 3: Response</a></a></li> </ol></li><li data-type="chapter"><a href="ch06.html#media">Media</a><ol> <li data-type="sect1"><a href="ch06.html#images">Images</a><ol> <li data-type="sect2"><a href="ch06.html#example_6-1_colon_load_an_image"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_06_01">Example 6-1: Load an Image</a></a></li> <li data-type="sect2"><a href="ch06.html#example_6-2_colon_load_more_images"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_06_02">Example 6-2: Load More Images</a></a></li> <li data-type="sect2"><a href="ch06.html#example_6-3_colon_mousing_around_with_im"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_06_03">Example 6-3: Mousing Around with Images</a></a></li> <li data-type="sect2"><a href="ch06.html#example_6-4_colon_transparency_with_a_gi"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_06_04">Example 6-4: Transparency with a GIF</a></a></li> <li data-type="sect2"><a href="ch06.html#example_6-5_colon_transparency_with_a_pn"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_06_05">Example 6-5: Transparency with a PNG</a></a></li> </ol></li> <li data-type="sect1"><a href="ch06.html#fonts">Fonts</a><ol> <li data-type="sect2"><a href="ch06.html#example_6-6_colon_drawing_with_fonts"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_06_06">Example 6-6: Drawing with Fonts</a></a></li> <li data-type="sect2"><a href="ch06.html#example_6-7_colon_draw_text_in_a_box"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_06_07">Example 6-7: Draw Text in a Box</a></a></li> <li data-type="sect2"><a href="ch06.html#example_6-8_colon_store_text_in_a_string"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_06_08">Example 6-8: Store Text in a <em>String</em></a></a></li> </ol></li> <li data-type="sect1"><a href="ch06.html#shapes">Shapes</a><ol> <li data-type="sect2"><a href="ch06.html#example_6-9_colon_draw_with_shapes"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_06_09">Example 6-9: Draw with Shapes</a></a></li> <li data-type="sect2"><a href="ch06.html#example_6-10_colon_scaling_shapes"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_06_10">Example 6-10: Scaling Shapes</a></a></li> </ol></li> <li data-type="sect1"><a href="ch06.html#robot_4_colon_media"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Robot4_Media">Robot 4: Media</a></a></li> </ol></li><li data-type="chapter"><a href="ch07.html#motion">Motion</a><ol> <li data-type="sect1"><a href="ch07.html#example_7-1_colon_see_the_frame">PROD: Insert Section Title Here</a><ol> <li data-type="sect2"><a href="ch07.html#example_7-1_colon_see_the_frame-id1"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_01">Example 7-1: See the Frame Rate</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-2_colon_set_the_frame_rate"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_02">Example 7-2: Set the Frame Rate</a></a></li> </ol></li> <li data-type="sect1"><a href="ch07.html#speed_and_direction">Speed and Direction</a><ol> <li data-type="sect2"><a href="ch07.html#example_7-3_colon_move_a_shape"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_03">Example 7-3: Move a Shape</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-4_colon_wrap_around"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_04">Example 7-4: Wrap Around</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-5_colon_bounce_off_the_wall"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_05">Example 7-5: Bounce Off the Wall</a></a></li> </ol></li> <li data-type="sect1"><a href="ch07.html#tweening">Tweening</a><ol> <li data-type="sect2"><a href="ch07.html#example_7-6_colon_calculate_tween_positi"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_06">Example 7-6: Calculate Tween Positions</a></a></li> </ol></li> <li data-type="sect1"><a href="ch07.html#random">Random</a><ol> <li data-type="sect2"><a href="ch07.html#example_7-7_colon_generate_random_values"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_07">Example 7-7: Generate Random Values</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-8_colon_draw_randomly"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_08">Example 7-8: Draw Randomly</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-9_colon_move_shapes_randomly"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_09">Example 7-9: Move Shapes Randomly</a></a></li> </ol></li> <li data-type="sect1"><a href="ch07.html#timers">Timers</a><ol> <li data-type="sect2"><a href="ch07.html#example_7-10_colon_time_passes"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_10">Example 7-10: Time Passes</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-11_colon_triggering_timed_even"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_11">Example 7-11: Triggering Timed Events</a></a></li> </ol></li> <li data-type="sect1"><a href="ch07.html#circular">Circular</a><ol> <li data-type="sect2"><a href="ch07.html#example_7-12_colon_sine_wave_values"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_12">Example 7-12: Sine Wave Values</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-13_colon_sine_wave_movement"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_13">Example 7-13: Sine Wave Movement</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-14_colon_circular_motion"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_14">Example 7-14: Circular Motion</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-15_colon_spirals"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_15">Example 7-15: Spirals</a></a></li> </ol></li> <li data-type="sect1"><a href="ch07.html#translate_comma_rotate_comma_scale">Translate, Rotate, Scale</a><ol> <li data-type="sect2"><a href="ch07.html#example_7-16_colon_translating_location"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_16">Example 7-16: Translating Location</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-17_colon_multiple_translations"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_17">Example 7-17: Multiple Translations</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-18_colon_isolating_transformat"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_18">Example 7-18: Isolating Transformations</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-19_colon_rotation"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_19">Example 7-19: Rotation</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-20_colon_combining_transformat"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_20">Example 7-20: Combining Transformations</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-21_colon_scaling"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_21">Example 7-21: Scaling</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-22_colon_keeping_strokes_consi"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_22">Example 7-22: Keeping Strokes Consistent</a></a></li> <li data-type="sect2"><a href="ch07.html#example_7-23_colon_an_articulating_arm"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_07_23">Example 7-23: An Articulating Arm</a></a></li> </ol></li> <li data-type="sect1"><a href="ch07.html#robot_5_colon_motion"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Robot5_Motion">Robot 5: Motion</a></a></li> </ol></li><li data-type="chapter"><a href="ch08.html#functions">Functions</a><ol> <li data-type="sect1"><a href="ch08.html#function_basics">Function Basics</a><ol> <li data-type="sect2"><a href="ch08.html#example_8-1_colon_roll_the_dice"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_08_01">Example 8-1: Roll the Dice</a></a></li> <li data-type="sect2"><a href="ch08.html#example_8-2_colon_another_way_to_roll"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_08_02">Example 8-2: Another Way to Roll</a></a></li> </ol></li> <li data-type="sect1"><a href="ch08.html#make_a_function">Make a Function</a><ol> <li data-type="sect2"><a href="ch08.html#example_8-3_colon_draw_the_owl"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_08_03">Example 8-3: Draw the Owl</a></a></li> <li data-type="sect2"><a href="ch08.html#example_8-4_colon_two_apostrophy_s_compa"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_08_04">Example 8-4: Two’s Company</a></a></li> <li data-type="sect2"><a href="ch08.html#example_8-5_colon_an_owl_function"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_08_05">Example 8-5: An Owl Function</a></a></li> <li data-type="sect2"><a href="ch08.html#example_8-6_colon_increasing_the_surplus"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_08_06">Example 8-6: Increasing the Surplus Population</a></a></li> <li data-type="sect2"><a href="ch08.html#example_8-7_colon_owls_of_different_size"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_08_07">Example 8-7: Owls of Different Sizes</a></a></li> </ol></li> <li data-type="sect1"><a href="ch08.html#return_values">Return Values</a><ol> <li data-type="sect2"><a href="ch08.html#example_8-8_colon_return_a_value"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_08_08">Example 8-8: Return a Value</a></a></li> </ol></li> <li data-type="sect1"><a href="ch08.html#robot_6_colon_functions"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Robot6_Functions">Robot 6: Functions</a></a></li> </ol></li><li data-type="chapter"><a href="ch09.html#objects">Objects</a><ol> <li data-type="sect1"><a href="ch09.html#classes_and_objects">Classes and Objects</a><ol> <li data-type="sect2"><a href="ch09.html#define_a_class">Define a Class</a></li> <li data-type="sect2"><a href="ch09.html#example_9-1_colon_make_an_object"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_09_01">Example 9-1: Make an Object</a></a></li> <li data-type="sect2"><a href="ch09.html#example_9-2_colon_making_multiple_object"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_09_02">Example 9-2: Making Multiple Objects</a></a></li> </ol></li> <li data-type="sect1"><a href="ch09.html#robot_7_colon_objects"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Robot7_Objects">Robot 7: Objects</a></a></li> </ol></li><li data-type="chapter"><a href="ch10.html#arrays">Arrays</a><ol> <li data-type="sect1"><a href="ch10.html#example_10-1_colon_many_variables">PROD: Insert Section Title Here</a><ol> <li data-type="sect2"><a href="ch10.html#example_10-1_colon_many_variables-id1"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_10_01">Example 10-1: Many Variables</a></a></li> <li data-type="sect2"><a href="ch10.html#example_10-2_colon_too_many_variables"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_10_02">Example 10-2: Too Many Variables</a></a></li> <li data-type="sect2"><a href="ch10.html#example_10-3_colon_arrays_comma_not_vari"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_10_03">Example 10-3: Arrays, Not Variables</a></a></li> </ol></li> <li data-type="sect1"><a href="ch10.html#make_an_array">Make an Array</a><ol> <li data-type="sect2"><a href="ch10.html#example_10-4_colon_declare_and_assign_an"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_10_04">Example 10-4: Declare and Assign an Array</a></a></li> <li data-type="sect2"><a href="ch10.html#example_10-5_colon_compact_array_assignm"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_10_05">Example 10-5: Compact Array Assignment</a></a></li> <li data-type="sect2"><a href="ch10.html#example_10-6_colon_assigning_to_an_array"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_10_06">Example 10-6: Assigning to an Array in One Go</a></a></li> <li data-type="sect2"><a href="ch10.html#example_10-7_colon_revisiting_the_first"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_10_07">Example 10-7: Revisiting the First Example</a></a></li> </ol></li> <li data-type="sect1"><a href="ch10.html#repetition_and_arrays">Repetition and Arrays</a><ol> <li data-type="sect2"><a href="ch10.html#example_10-8_colon_filling_an_array_in_a"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_10_08">Example 10-8: Filling an Array in a <em>for</em> Loop</a></a></li> <li data-type="sect2"><a href="ch10.html#example_10-9_colon_track_mouse_movements"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_10_09">Example 10-9: Track Mouse Movements</a></a></li> </ol></li> <li data-type="sect1"><a href="ch10.html#arrays_of_objects">Arrays of Objects</a><ol> <li data-type="sect2"><a href="ch10.html#example_10-10_colon_managing_many_object"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_10_10">Example 10-10: Managing Many Objects</a></a></li> <li data-type="sect2"><a href="ch10.html#example_10-11_colon_sequences_of_images"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Ex_10_11">Example 10-11: Sequences of Images</a></a></li> </ol></li> <li data-type="sect1"><a href="ch10.html#robot_8_colon_arrays"><a href="http://examples.oreilly.com/0636920000570/interactive_examples/index.php?example=Robot8_Arrays">Robot 8: Arrays</a></a></li> </ol></li><li data-type="chapter"><a href="ch11.html#extend">Extend</a><ol> <li data-type="sect1"><a href="ch11.html#d">3D</a><ol> <li data-type="sect2"><a href="ch11.html#example_11-1_colon_a_3d_demo">Example 11-1: A 3D Demo</a></li> <li data-type="sect2"><a href="ch11.html#example_11-2_colon_lighting">Example 11-2: Lighting</a></li> <li data-type="sect2"><a href="ch11.html#example_11-3_colon_the_processing_camera">Example 11-3: The Processing Camera</a></li> </ol></li> <li data-type="sect1"><a href="ch11.html#image_export">Image Export</a><ol> <li data-type="sect2"><a href="ch11.html#example_11-4_colon_saving_images">Example 11-4: Saving Images</a></li> <li data-type="sect2"><a href="ch11.html#example_11-5_colon_draw_to_a_pdf">Example 11-5: Draw to a PDF</a></li> </ol></li> <li data-type="sect1"><a href="ch11.html#hello_arduino">Hello Arduino</a><ol> <li data-type="sect2"><a href="ch11.html#example_11-6_colon_read_a_sensor">Example 11-6: Read a Sensor</a></li> <li data-type="sect2"><a href="ch11.html#example_11-7_colon_read_data_from_the_se">Example 11-7: Read Data from the Serial Port</a></li> <li data-type="sect2"><a href="ch11.html#example_11-8_colon_visualizing_the_data">Example 11-8: Visualizing the Data Stream</a></li> <li data-type="sect2"><a href="ch11.html#example_11-9_colon_another_way_to_look_a">Example 11-9: Another Way to Look at the Data</a></li> </ol></li> <li data-type="sect1"><a href="ch11.html#community">Community</a></li> </ol></li><li data-type="appendix"><a href="app01.html#coding_tips">Coding Tips</a><ol> <li data-type="sect1"><a href="app01.html#functions_and_parameters">Functions and Parameters</a></li> <li data-type="sect1"><a href="app01.html#color_coding">Color Coding</a></li> <li data-type="sect1"><a href="app01.html#comments-id1">Comments</a></li> <li data-type="sect1"><a href="app01.html#uppercase_and_lowercase">Uppercase and Lowercase</a></li> <li data-type="sect1"><a href="app01.html#style">Style</a></li> <li data-type="sect1"><a href="app01.html#console">Console</a></li> <li data-type="sect1"><a href="app01.html#one_step_at_a_time">One Step at a Time</a></li> </ol></li><li data-type="appendix"><a href="app02.html#data_types">Data Types</a></li><li data-type="appendix"><a href="app03.html#order_of_operations">Order of Operations</a></li><li data-type="appendix"><a href="app04.html#variable_scope">Variable Scope</a></li><li data-type="index"><a href="ix01.html#idp3347536">Index</a></li></ol></nav> </body> </html>