ruby-processing 1.0.11 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.travis.yml +6 -0
- data/.yardopts +5 -0
- data/CHANGELOG +81 -0
- data/CONTRIBUTING.md +33 -0
- data/Gemfile +6 -0
- data/{LICENSE → LICENSE.md} +6 -4
- data/README.md +114 -0
- data/Rakefile +37 -0
- data/bin/install_jruby_complete +13 -0
- data/lib/ruby-processing.rb +3 -10
- data/lib/ruby-processing/app.rb +92 -137
- data/lib/ruby-processing/config.rb +14 -3
- data/lib/ruby-processing/exporters/application_exporter.rb +9 -5
- data/lib/ruby-processing/exporters/base_exporter.rb +3 -3
- data/lib/ruby-processing/exporters/creator.rb +4 -4
- data/lib/ruby-processing/exporters/exporters.rb +7 -0
- data/lib/ruby-processing/helper_methods.rb +18 -7
- data/lib/ruby-processing/library_loader.rb +17 -16
- data/lib/ruby-processing/runner.rb +38 -34
- data/lib/ruby-processing/runners/base.rb +1 -13
- data/lib/ruby-processing/runners/run.rb +2 -1
- data/lib/ruby-processing/runners/watch.rb +1 -1
- data/lib/ruby-processing/version.rb +3 -0
- data/lib/templates/application/Contents/Info.plist.erb +2 -2
- data/lib/templates/application/lib/args.txt.erb +1 -1
- data/lib/templates/application/run.erb +2 -1
- data/lib/templates/create/blank_sketch.rb.erb +4 -12
- data/lib/templates/create/p3d_sketch.rb.erb +7 -0
- data/library/boids/boids.rb +76 -58
- data/library/control_panel/control_panel.rb +21 -18
- data/library/file_chooser/file_chooser.rb +90 -0
- data/library/vecmath/vecmath.rb +323 -0
- data/ruby-processing.gemspec +54 -0
- data/samples/contributed/animator.rb +9 -4
- data/samples/contributed/bezier_playground.rb +178 -184
- data/samples/contributed/circle_collision.rb +164 -171
- data/samples/contributed/drawolver.rb +111 -162
- data/samples/contributed/empathy.rb +14 -12
- data/samples/contributed/fern.rb +1 -1
- data/samples/contributed/fibonacci_sphere.rb +125 -0
- data/samples/contributed/flight_patterns.rb +7 -14
- data/samples/contributed/full_screen.rb +4 -6
- data/samples/contributed/grapher.rb +35 -0
- data/samples/contributed/gravity.rb +22 -24
- data/samples/contributed/jwishy.rb +75 -63
- data/samples/contributed/mandelbrot.rb +82 -0
- data/samples/contributed/orbit.rb +5 -4
- data/samples/contributed/pong.rb +152 -150
- data/samples/contributed/quadraticvertex.rb +98 -0
- data/samples/contributed/re_sample.rb +27 -0
- data/samples/contributed/simple_buffer.rb +38 -43
- data/samples/contributed/tree.rb +63 -70
- data/samples/external_library/java_processing/README +3 -0
- data/samples/external_library/java_processing/fisica/README +1 -0
- data/samples/external_library/java_processing/fisica/bubbles.rb +80 -0
- data/samples/external_library/java_processing/fisica/joints.rb +112 -0
- data/samples/external_library/java_processing/fisica/polygons.rb +79 -0
- data/samples/external_library/java_processing/fisica/raycast.rb +61 -0
- data/samples/external_library/java_processing/generative_design/mesh_example.rb +25 -0
- data/samples/external_library/java_processing/generative_design/node_spring_attractor.rb +83 -0
- data/samples/external_library/java_processing/generative_design/sub_class_example.rb +44 -0
- data/samples/external_library/java_processing/geomerative/data/FreeSans.ttf +0 -0
- data/samples/external_library/java_processing/geomerative/data/Toucan.svg +43 -0
- data/samples/external_library/java_processing/geomerative/hello_bot_ignore_styles.rb +38 -0
- data/samples/external_library/java_processing/geomerative/hello_world_rotate_firstletter.rb +43 -0
- data/samples/external_library/java_processing/geomerative/hola_mundo.rb +37 -0
- data/samples/external_library/java_processing/grafica/data/OktoberfestVSGermanElections.csv +118 -0
- data/samples/external_library/java_processing/grafica/default_plot.rb +30 -0
- data/samples/external_library/java_processing/grafica/multiple_panels.rb +117 -0
- data/samples/external_library/java_processing/grafica/oktoberfest_example.rb +83 -0
- data/samples/external_library/java_processing/hemesh/data/java_args.txt +2 -0
- data/samples/external_library/java_processing/hemesh/library/vbo/mesh_to_vbo.rb +43 -0
- data/samples/external_library/java_processing/hemesh/twin_iso.rb +71 -0
- data/samples/external_library/java_processing/pbox2d/bumpy_surface_noise.rb +57 -0
- data/samples/external_library/java_processing/pbox2d/contact_test.rb +23 -0
- data/samples/external_library/java_processing/pbox2d/data/java_args.txt +2 -0
- data/samples/external_library/java_processing/pbox2d/library/custom_shape/custom_shape.rb +158 -0
- data/samples/external_library/java_processing/pbox2d/library/particle_system/particle_system.rb +212 -0
- data/samples/external_library/java_processing/pbox2d/library/surface/surface.rb +154 -0
- data/samples/external_library/java_processing/pbox2d/liquidy.rb +58 -0
- data/samples/external_library/java_processing/pbox2d/polygons.rb +58 -0
- data/samples/{peasy_cam → external_library/java_processing/peasy_cam}/hello_peasy.rb +4 -4
- data/samples/external_library/java_processing/peasy_cam/hilbert_fractal.rb +34 -0
- data/samples/{peasy_cam → external_library/java_processing/peasy_cam}/library/hilbert/hilbert.rb +1 -1
- data/samples/external_library/java_processing/proscene/cad_camera.rb +57 -0
- data/samples/external_library/java_processing/proscene/camera_customization.rb +114 -0
- data/samples/external_library/java_processing/proscene/data/ti_yong.png +0 -0
- data/samples/external_library/java_processing/toxiclibs/data/ti_yong.png +0 -0
- data/samples/external_library/java_processing/toxiclibs/gray_scott_image.rb +79 -0
- data/samples/external_library/java_processing/toxiclibs/gray_scott_tone_map.rb +78 -0
- data/samples/external_library/java_processing/toxiclibs/implicit.rb +143 -0
- data/samples/external_library/java_processing/toxiclibs/library/vbo/mesh_to_vbo.rb +52 -0
- data/samples/external_library/java_processing/toxiclibs/model_align.rb +55 -0
- data/samples/external_library/ruby_gem/README +12 -0
- data/samples/external_library/ruby_gem/data/README.txt +1 -0
- data/samples/external_library/ruby_gem/data/java_args.txt +2 -0
- data/samples/external_library/ruby_gem/game_of_life.rb +127 -0
- data/samples/external_library/ruby_gem/mdarray_test.rb +28 -0
- data/samples/processing_app/basics/arrays/array.rb +23 -29
- data/samples/processing_app/basics/arrays/array_2d.rb +22 -28
- data/samples/processing_app/basics/arrays/array_objects.rb +50 -55
- data/samples/processing_app/basics/camera/move_eye.rb +24 -0
- data/samples/processing_app/{3D → basics}/camera/perspective.rb +0 -0
- data/samples/processing_app/basics/color/brightness.rb +15 -21
- data/samples/processing_app/basics/color/color_wheel.rb +72 -79
- data/samples/processing_app/basics/color/creating.rb +35 -24
- data/samples/processing_app/basics/color/hue.rb +16 -22
- data/samples/processing_app/basics/color/linear_gradient.rb +35 -40
- data/samples/processing_app/basics/color/radial_gradient.rb +26 -34
- data/samples/processing_app/basics/color/reading/reading.rb +2 -7
- data/samples/processing_app/basics/color/relativity.rb +19 -32
- data/samples/processing_app/basics/color/saturation.rb +15 -26
- data/samples/processing_app/basics/color/wave_gradient.rb +25 -36
- data/samples/processing_app/basics/control/conditionals1.rb +20 -25
- data/samples/processing_app/basics/control/conditionals2.rb +27 -32
- data/samples/processing_app/basics/control/embedded_iteration.rb +25 -33
- data/samples/processing_app/basics/control/iteration.rb +43 -54
- data/samples/processing_app/basics/control/logical_operators.rb +45 -48
- data/samples/processing_app/basics/data/characters_strings.rb +50 -0
- data/samples/processing_app/basics/data/datatype_conversion.rb +28 -32
- data/samples/processing_app/basics/data/integers_floats.rb +18 -24
- data/samples/processing_app/basics/data/true_false.rb +19 -25
- data/samples/processing_app/basics/data/variable_scope.rb +51 -57
- data/samples/processing_app/basics/data/variables.rb +27 -32
- data/samples/processing_app/basics/form/bezier.rb +11 -14
- data/samples/processing_app/basics/form/bezier_ellipse.rb +79 -90
- data/samples/processing_app/basics/form/brick_tower.rb +92 -0
- data/samples/processing_app/basics/form/cubic_grid.rb +39 -0
- data/samples/processing_app/{3D → basics}/form/icosahedra/icosahedra.rb +32 -36
- data/samples/processing_app/{3D → basics}/form/icosahedra/icosahedron.rb +1 -1
- data/samples/processing_app/{3D → basics}/form/icosahedra/shape_3D.rb +0 -0
- data/samples/processing_app/basics/form/pie_chart.rb +17 -21
- data/samples/processing_app/basics/form/points_lines.rb +11 -16
- data/samples/processing_app/{3D → basics}/form/primitives.rb +11 -25
- data/samples/processing_app/basics/form/regular_polygon.rb +46 -0
- data/samples/processing_app/basics/form/rgb_cube.rb +68 -0
- data/samples/processing_app/basics/form/shape_primitives.rb +15 -17
- data/samples/processing_app/basics/form/shape_transform.rb +88 -0
- data/samples/processing_app/basics/form/star.rb +48 -0
- data/samples/processing_app/basics/form/toroid.rb +127 -0
- data/samples/processing_app/basics/form/triangle_strip.rb +29 -33
- data/samples/processing_app/basics/form/vertices.rb +36 -40
- data/samples/processing_app/basics/image/alphamask.rb +10 -16
- data/samples/processing_app/basics/image/background_image.rb +16 -22
- data/samples/processing_app/basics/image/create_image.rb +10 -16
- data/samples/processing_app/{3D → basics}/image/data/ystone08.jpg +0 -0
- data/samples/processing_app/basics/image/extrusion.rb +46 -0
- data/samples/processing_app/basics/image/load_display_image.rb +12 -19
- data/samples/processing_app/basics/image/pointillism.rb +13 -19
- data/samples/processing_app/basics/image/request_image.rb +41 -50
- data/samples/processing_app/basics/image/sprite.rb +19 -25
- data/samples/processing_app/basics/image/transparency.rb +14 -20
- data/samples/processing_app/basics/image/zoom.rb +59 -0
- data/samples/processing_app/basics/input/clock.rb +32 -38
- data/samples/processing_app/basics/input/constrain.rb +25 -31
- data/samples/processing_app/basics/input/easing.rb +18 -20
- data/samples/processing_app/basics/input/keyboard.rb +16 -22
- data/samples/processing_app/basics/input/keyboard_functions.rb +49 -68
- data/samples/processing_app/basics/input/milliseconds.rb +11 -16
- data/samples/processing_app/basics/input/mouse_1d.rb +19 -26
- data/samples/processing_app/basics/input/mouse_2d.rb +14 -20
- data/samples/processing_app/basics/input/mouse_functions.rb +56 -61
- data/samples/processing_app/basics/input/mouse_press.rb +9 -15
- data/samples/processing_app/basics/input/mouse_signals.rb +29 -34
- data/samples/processing_app/basics/input/storing_input.rb +28 -29
- data/samples/processing_app/basics/lights/directional.rb +37 -0
- data/samples/processing_app/basics/lights/lights1.rb +35 -0
- data/samples/processing_app/basics/lights/lights2.rb +38 -0
- data/samples/processing_app/basics/lights/reflection.rb +35 -0
- data/samples/processing_app/basics/lights/spot.rb +36 -0
- data/samples/processing_app/basics/math/additive_wave.rb +51 -53
- data/samples/processing_app/basics/math/arctangent.rb +34 -44
- data/samples/processing_app/basics/math/distance1.rb +44 -50
- data/samples/processing_app/basics/math/distance2.rb +14 -30
- data/samples/processing_app/basics/math/double_random.rb +23 -30
- data/samples/processing_app/basics/math/graphing_2_d_equation.rb +30 -44
- data/samples/processing_app/basics/math/increment_decrement.rb +37 -42
- data/samples/processing_app/basics/math/interpolate.rb +34 -0
- data/samples/processing_app/basics/math/modulo.rb +25 -29
- data/samples/processing_app/basics/math/noise_1_d.rb +14 -30
- data/samples/processing_app/basics/math/noise_2_d.rb +22 -39
- data/samples/processing_app/basics/math/noise_3_d.rb +24 -44
- data/samples/processing_app/basics/math/noise_wave.rb +35 -55
- data/samples/processing_app/basics/math/operator_precedence.rb +24 -45
- data/samples/processing_app/basics/math/polar_to_cartesian.rb +22 -35
- data/samples/processing_app/basics/math/random.rb +13 -27
- data/samples/processing_app/basics/math/random_gaussian.rb +23 -0
- data/samples/processing_app/basics/math/sine.rb +27 -41
- data/samples/processing_app/basics/math/sine_cosine.rb +37 -49
- data/samples/processing_app/basics/math/sine_wave.rb +33 -52
- data/samples/processing_app/basics/objects/composite_objects.rb +94 -120
- data/samples/processing_app/basics/objects/inheritance.rb +64 -86
- data/samples/processing_app/basics/objects/multiple_constructors.rb +25 -38
- data/samples/processing_app/basics/objects/objects.rb +42 -57
- data/samples/processing_app/basics/shape/data/rocket.mtl +8 -0
- data/samples/processing_app/basics/shape/data/rocket.obj +1688 -0
- data/samples/processing_app/basics/shape/data/rocket.png +0 -0
- data/samples/processing_app/basics/shape/disable_style.rb +21 -25
- data/samples/processing_app/basics/shape/get_child.rb +27 -30
- data/samples/processing_app/basics/shape/load_display_obj.rb +25 -0
- data/samples/processing_app/basics/shape/load_display_shape.rb +10 -23
- data/samples/processing_app/basics/shape/load_display_svg.rb +22 -0
- data/samples/processing_app/basics/shape/scale_shape.rb +13 -23
- data/samples/processing_app/basics/structure/coordinates.rb +12 -25
- data/samples/processing_app/basics/structure/create_graphics.rb +18 -28
- data/samples/processing_app/basics/structure/functions.rb +19 -31
- data/samples/processing_app/basics/structure/loop.rb +21 -35
- data/samples/processing_app/basics/structure/noloop.rb +13 -25
- data/samples/processing_app/basics/structure/recursion1.rb +18 -33
- data/samples/processing_app/basics/structure/recursion2.rb +18 -34
- data/samples/processing_app/basics/structure/redraw.rb +16 -27
- data/samples/processing_app/basics/structure/setup_draw.rb +11 -22
- data/samples/processing_app/basics/structure/statements_comments.rb +7 -13
- data/samples/processing_app/basics/structure/width_height.rb +7 -14
- data/samples/processing_app/{3D → basics}/textures/data/berlin-1.jpg +0 -0
- data/samples/processing_app/basics/textures/texture1.rb +28 -0
- data/samples/processing_app/basics/textures/texture2.rb +33 -0
- data/samples/processing_app/basics/textures/texture3.rb +64 -0
- data/samples/processing_app/basics/textures/texture_cube.rb +86 -0
- data/samples/processing_app/basics/transform/arm.rb +22 -37
- data/samples/processing_app/basics/transform/bird.rb +57 -0
- data/samples/processing_app/basics/transform/birds.rb +38 -0
- data/samples/processing_app/basics/transform/cubes_in_cube.rb +99 -0
- data/samples/processing_app/{3D/transform/birds → basics/transform/library/bird}/bird.rb +0 -0
- data/samples/processing_app/{3D/transform/cubes_in_cube → basics/transform/library/cube}/cube.rb +10 -12
- data/samples/processing_app/basics/transform/rotate.rb +17 -31
- data/samples/processing_app/basics/transform/rotate1.rb +27 -0
- data/samples/processing_app/basics/transform/rotate_push_pop.rb +35 -0
- data/samples/processing_app/basics/transform/rotate_x_y.rb +36 -0
- data/samples/processing_app/basics/transform/scale.rb +19 -35
- data/samples/processing_app/basics/transform/translate.rb +18 -32
- data/samples/processing_app/basics/transform/triangle_flower.rb +38 -55
- data/samples/processing_app/{3D → basics}/typography/data/Univers45.vlw +0 -0
- data/samples/processing_app/{3D → basics}/typography/kinetic_type.rb +1 -5
- data/samples/processing_app/basics/typography/letters.rb +26 -44
- data/samples/processing_app/basics/typography/words.rb +29 -30
- data/samples/processing_app/basics/web/embedded_links.rb +39 -45
- data/samples/processing_app/basics/web/loading_images.rb +6 -16
- data/samples/processing_app/demos/graphics/bezier_patch.rb +227 -0
- data/samples/processing_app/demos/graphics/data/frag.glsl +30 -0
- data/samples/processing_app/demos/graphics/data/java_args.txt +2 -0
- data/samples/processing_app/demos/graphics/data/mercury.jpg +0 -0
- data/samples/processing_app/demos/graphics/data/planet.jpg +0 -0
- data/samples/processing_app/demos/graphics/data/starfield.jpg +0 -0
- data/samples/processing_app/demos/graphics/data/sun.jpg +0 -0
- data/samples/processing_app/demos/graphics/data/vert.glsl +31 -0
- data/samples/processing_app/demos/graphics/low_level_gl.rb +72 -0
- data/samples/processing_app/demos/graphics/planets.rb +51 -0
- data/samples/processing_app/demos/graphics/trefoil.rb +142 -0
- data/samples/processing_app/demos/graphics/wiggling.rb +289 -0
- data/samples/processing_app/demos/performance/cubic_grid_retained.rb +58 -0
- data/samples/processing_app/demos/performance/data/java_args.txt +1 -0
- data/samples/processing_app/demos/performance/esfera.rb +105 -0
- data/samples/processing_app/demos/performance/text_rendering.rb +14 -0
- data/samples/processing_app/demos/tests/no_background_test.rb +10 -0
- data/samples/processing_app/demos/tests/offscreen_test.rb +34 -0
- data/samples/processing_app/demos/tests/redraw_test.rb +14 -0
- data/samples/processing_app/demos/tests/resize_test.rb +10 -0
- data/samples/processing_app/demos/tests/restart_test.rb +22 -0
- data/samples/processing_app/demos/tests/smooth_test.rb +27 -0
- data/samples/processing_app/demos/tests/specs_test.rb +11 -0
- data/samples/processing_app/library/dxf/simple_export.rb +48 -0
- data/samples/processing_app/library/file_chooser/image_viewer.rb +24 -0
- data/samples/processing_app/library/minim/filter_example.rb +65 -0
- data/samples/processing_app/library/minim/frequency_modulation.rb +64 -0
- data/samples/processing_app/library/minim/sequence_sound.rb +59 -0
- data/samples/processing_app/library/minim/synthesize_sound.rb +35 -0
- data/samples/processing_app/library/movie/README +1 -0
- data/samples/processing_app/library/movie/data/transit.mkv +0 -0
- data/samples/processing_app/library/movie/data/transit.mov +0 -0
- data/samples/processing_app/library/movie/loop.rb +24 -0
- data/samples/processing_app/library/movie/pixelate.rb +50 -0
- data/samples/processing_app/library/movie/reverse.rb +47 -0
- data/samples/processing_app/library/movie/scratch.rb +36 -0
- data/samples/processing_app/library/movie/speed.rb +33 -0
- data/samples/processing_app/library/net/HTTPClient.rb +31 -0
- data/samples/processing_app/library/pdf/.gitignore +1 -0
- data/samples/processing_app/library/pdf/complex_3D.rb +160 -0
- data/samples/processing_app/library/pdf/large_page.rb +25 -0
- data/samples/processing_app/library/pdf/many_frames.rb +33 -0
- data/samples/processing_app/library/pdf/many_pages.rb +31 -0
- data/samples/processing_app/library/pdf/many_pdfs.rb +37 -0
- data/samples/processing_app/library/pdf/one_frame.rb +19 -0
- data/samples/processing_app/library/vecmath/README.txt +2 -0
- data/samples/processing_app/library/vecmath/acceleration_with_vectors.rb +75 -0
- data/samples/processing_app/library/vecmath/bouncing_ball.rb +51 -0
- data/samples/processing_app/library/vecmath/circle_collision.rb +174 -0
- data/samples/processing_app/library/vecmath/data/java_args.txt +2 -0
- data/samples/processing_app/library/vecmath/data/sprite.png +0 -0
- data/samples/processing_app/library/vecmath/data/texture.png +0 -0
- data/samples/processing_app/library/vecmath/drawolver.rb +111 -0
- data/samples/processing_app/library/vecmath/flocking.rb +33 -0
- data/samples/processing_app/library/vecmath/hilbert_fractal.rb +65 -0
- data/samples/processing_app/library/vecmath/library/flock/flock.rb +214 -0
- data/samples/processing_app/library/vecmath/library/hilbert/hilbert.rb +84 -0
- data/samples/processing_app/library/vecmath/library/particle/particle_system.rb +106 -0
- data/samples/processing_app/library/vecmath/library/wiggler/wiggler.rb +58 -0
- data/samples/processing_app/library/vecmath/morph.rb +86 -0
- data/samples/processing_app/library/vecmath/multiple_particle_systems.rb +158 -0
- data/samples/processing_app/library/vecmath/particle_system_pshape.rb +38 -0
- data/samples/processing_app/library/vecmath/reflection1.rb +108 -0
- data/samples/processing_app/library/vecmath/retained_menger.rb +150 -0
- data/samples/processing_app/library/vecmath/retained_test.rb +65 -0
- data/samples/processing_app/library/vecmath/retained_test2.rb +65 -0
- data/samples/processing_app/library/vecmath/simple_particle_system.rb +89 -0
- data/samples/processing_app/library/vecmath/smoke_particle_system.rb +138 -0
- data/samples/processing_app/library/vecmath/vector_math.rb +39 -0
- data/samples/processing_app/library/vecmath/wiggle_pshape.rb +22 -0
- data/samples/processing_app/topics/advanced_data/README +1 -0
- data/samples/processing_app/topics/advanced_data/counting_words.rb +79 -0
- data/samples/processing_app/topics/advanced_data/data/Georgia.ttf +0 -0
- data/samples/processing_app/topics/advanced_data/data/Merriweather-Light.ttf +0 -0
- data/samples/processing_app/topics/advanced_data/data/a000 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a001 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a002 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a003 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a004 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a005 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a006 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a007 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a008 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a009 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a010 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a011 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a012 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a013 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a014 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a015 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a016 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a017 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a018 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a019 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a020 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a021 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a022 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a023 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a024 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a025 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a026 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a027 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a028 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a029 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a030 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a031 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a032 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a033 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a034 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a035 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a036 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a037 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a038 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a039 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a040 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a041 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a042 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a043 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a044 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a045 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a046 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a047 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a048 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a049 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a050 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a051 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a052 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a053 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a054 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a055 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a056 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a057 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a058 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a059 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a060 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a061 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a062 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a063 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a064 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a065 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a066 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a067 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a068 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a069 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a070 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a071 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a072 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a073 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a074 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a075 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a076 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a077 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a078 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a079 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a080 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a081 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a082 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a083 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a084 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a085 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a086 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a087 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a088 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a089 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a090 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a091 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a092 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a093 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a094 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a095 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a096 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a097 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a098 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a099 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a100 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a101 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a102 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a103 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a104 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a105 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a106 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a107 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a108 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a109 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a110 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a111 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a112 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a113 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a114 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/a115 copy.jpg +0 -0
- data/samples/processing_app/topics/advanced_data/data/data.csv +5 -0
- data/samples/processing_app/topics/advanced_data/data/data.json +36 -0
- data/samples/processing_app/topics/advanced_data/data/data.xml +38 -0
- data/samples/processing_app/topics/advanced_data/data/data.yml +22 -0
- data/samples/processing_app/topics/advanced_data/data/dracula.txt +16624 -0
- data/samples/processing_app/topics/advanced_data/data/frankenstein.txt +7652 -0
- data/samples/processing_app/topics/advanced_data/data/struct_data.yml +22 -0
- data/samples/processing_app/topics/advanced_data/library/bubble/bubble.rb +45 -0
- data/samples/processing_app/topics/advanced_data/library/word/word.rb +64 -0
- data/samples/processing_app/topics/advanced_data/load_save_XML.rb +114 -0
- data/samples/processing_app/topics/advanced_data/load_save_json.rb +93 -0
- data/samples/processing_app/topics/advanced_data/load_save_struct_yaml.rb +85 -0
- data/samples/processing_app/topics/advanced_data/load_save_table.rb +85 -0
- data/samples/processing_app/topics/advanced_data/load_save_yaml.rb +89 -0
- data/samples/processing_app/topics/advanced_data/regex.rb +47 -0
- data/samples/processing_app/topics/advanced_data/threads.rb +96 -0
- data/samples/processing_app/topics/advanced_data/threads_two.rb +52 -0
- data/samples/processing_app/topics/advanced_data/word_frequency.rb +78 -0
- data/samples/processing_app/topics/advanced_data/yahoo_weather.rb +38 -0
- data/samples/processing_app/topics/animation/README.txt +1 -0
- data/samples/processing_app/topics/animation/animated_sprite.rb +58 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0000.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0001.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0002.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0003.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0004.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0005.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0006.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0007.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0008.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0009.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0010.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0011.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0012.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0013.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0014.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0015.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0016.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0017.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0018.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0019.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0020.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0021.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0022.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0023.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0024.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0025.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0026.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0027.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0028.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0029.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0030.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0031.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0032.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0033.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0034.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0035.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0036.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Shifty_0037.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0000.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0001.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0002.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0003.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0004.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0005.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0006.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0007.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0008.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0009.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0010.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0011.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0012.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0013.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0014.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0015.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0016.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0017.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0018.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0019.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0020.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0021.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0022.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0023.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0024.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0025.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0026.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0027.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0028.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0029.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0030.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0031.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0032.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0033.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0034.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0035.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0036.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0037.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0038.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0039.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0040.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0041.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0042.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0043.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0044.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0045.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0046.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0047.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0048.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0049.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0050.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0051.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0052.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0053.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0054.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0055.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0056.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0057.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0058.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_Teddy_0059.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0000.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0001.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0002.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0003.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0004.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0005.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0006.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0007.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0008.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0009.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0010.gif +0 -0
- data/samples/processing_app/topics/animation/data/PT_anim0011.gif +0 -0
- data/samples/processing_app/topics/animation/sequential.rb +42 -0
- data/samples/processing_app/topics/cellular_automata/game_of_life.rb +125 -0
- data/samples/processing_app/topics/cellular_automata/library/ca/ca.rb +91 -0
- data/samples/processing_app/topics/cellular_automata/library/cell/cell.rb +99 -0
- data/samples/processing_app/topics/cellular_automata/library/simple_cell/simple_cell.rb +46 -0
- data/samples/processing_app/topics/cellular_automata/spore1.rb +94 -0
- data/samples/processing_app/topics/cellular_automata/spore2.rb +101 -0
- data/samples/processing_app/topics/cellular_automata/wolfram.rb +42 -0
- data/samples/processing_app/topics/create_shapes/begin_end_contour.rb +44 -0
- data/samples/processing_app/topics/create_shapes/data/sprite.png +0 -0
- data/samples/processing_app/topics/create_shapes/group_pshape.rb +69 -0
- data/samples/processing_app/topics/create_shapes/library/particle/particle_system.rb +107 -0
- data/samples/processing_app/topics/create_shapes/library/polygon/polygon.rb +35 -0
- data/samples/processing_app/topics/create_shapes/library/star/star.rb +47 -0
- data/samples/processing_app/topics/create_shapes/library/wiggler/wiggler.rb +57 -0
- data/samples/processing_app/topics/create_shapes/particle_system_pshape.rb +38 -0
- data/samples/processing_app/topics/create_shapes/path_pshape.rb +38 -0
- data/samples/processing_app/topics/create_shapes/polygon_pshape_oo3.rb +56 -0
- data/samples/processing_app/topics/create_shapes/polygon_pshape_oop.rb +29 -0
- data/samples/processing_app/topics/create_shapes/polygon_pshape_oop2.rb +52 -0
- data/samples/processing_app/topics/create_shapes/polygon_shape.rb +42 -0
- data/samples/processing_app/topics/create_shapes/primitive_pshape.rb +29 -0
- data/samples/processing_app/topics/create_shapes/wiggle_pshape.rb +22 -0
- data/samples/processing_app/topics/drawing/continuous_lines.rb +17 -0
- data/samples/processing_app/topics/drawing/pattern.rb +30 -0
- data/samples/processing_app/topics/drawing/pulses.rb +33 -0
- data/samples/processing_app/topics/drawing/scribble_plotter.rb +77 -0
- data/samples/processing_app/topics/effects/lens.rb +68 -70
- data/samples/processing_app/topics/file_io/data/positions.txt +206 -0
- data/samples/processing_app/topics/file_io/load_file1.rb +32 -0
- data/samples/processing_app/topics/file_io/save_frames.rb +70 -0
- data/samples/processing_app/topics/file_io/save_one_image.rb +22 -0
- data/samples/processing_app/topics/file_io/tile_images.rb +37 -0
- data/samples/processing_app/topics/gui/button.rb +74 -0
- data/samples/processing_app/topics/gui/data/seedBottom.jpg +0 -0
- data/samples/processing_app/topics/gui/data/seedTop.jpg +0 -0
- data/samples/processing_app/topics/gui/handles.rb +108 -0
- data/samples/processing_app/topics/gui/rollover.rb +63 -0
- data/samples/processing_app/topics/gui/scrollbar.rb +96 -0
- data/samples/processing_app/topics/image_processing/blending.rb +82 -0
- data/samples/processing_app/topics/image_processing/blur.rb +50 -0
- data/samples/processing_app/topics/image_processing/brightness.rb +39 -0
- data/samples/processing_app/topics/image_processing/convolution.rb +72 -0
- data/samples/processing_app/{3D/image → topics/image_processing}/data/eames.jpg +0 -0
- data/samples/processing_app/topics/image_processing/data/frontier.jpg +0 -0
- data/samples/processing_app/topics/image_processing/data/java_args.txt +3 -0
- data/samples/processing_app/topics/image_processing/data/layer1.jpg +0 -0
- data/samples/processing_app/topics/image_processing/data/layer2.jpg +0 -0
- data/samples/processing_app/topics/image_processing/data/moon-wide.jpg +0 -0
- data/samples/processing_app/topics/image_processing/data/moon.jpg +0 -0
- data/samples/processing_app/topics/image_processing/data/sea.jpg +0 -0
- data/samples/processing_app/topics/image_processing/data/ystone08.jpg +0 -0
- data/samples/processing_app/topics/image_processing/edge_detection.rb +47 -0
- data/samples/processing_app/topics/image_processing/explode.rb +35 -0
- data/samples/processing_app/topics/image_processing/extrusion.rb +49 -0
- data/samples/processing_app/topics/image_processing/histogram.rb +43 -0
- data/samples/processing_app/topics/image_processing/linear_image.rb +45 -0
- data/samples/processing_app/topics/image_processing/pixel_array.rb +48 -0
- data/samples/processing_app/topics/image_processing/zoom.rb +66 -0
- data/samples/processing_app/topics/lsystems/chequer.rb +72 -0
- data/samples/processing_app/topics/lsystems/csplant.rb +100 -0
- data/samples/processing_app/topics/lsystems/cstest.rb +20 -0
- data/samples/processing_app/topics/lsystems/data/java_args.txt +3 -0
- data/samples/processing_app/topics/lsystems/david_tour.rb +77 -0
- data/samples/processing_app/topics/lsystems/koch.rb +29 -0
- data/samples/processing_app/topics/lsystems/library/cs_grammar/cs_grammar.rb +88 -0
- data/samples/processing_app/topics/lsystems/library/grammar/grammar.rb +33 -0
- data/samples/processing_app/topics/lsystems/library/koch/koch_fractal.rb +117 -0
- data/samples/processing_app/topics/lsystems/library/stochastic_grammar/stochastic_grammar.rb +58 -0
- data/samples/processing_app/topics/lsystems/mpeano.rb +83 -0
- data/samples/processing_app/topics/lsystems/peano.rb +78 -0
- data/samples/processing_app/topics/lsystems/penrose.rb +123 -0
- data/samples/processing_app/topics/lsystems/penrose_snowflake.rb +93 -0
- data/samples/processing_app/topics/lsystems/pentagonal.rb +103 -0
- data/samples/processing_app/topics/lsystems/snake_kolam.rb +93 -0
- data/samples/processing_app/topics/lsystems/stochastic_test.rb +99 -0
- data/samples/processing_app/topics/lsystems/three_d_tree.rb +108 -0
- data/samples/processing_app/topics/motion/bounce.rb +40 -0
- data/samples/processing_app/topics/motion/bouncy_bubbles.rb +96 -0
- data/samples/processing_app/topics/motion/brownian.rb +40 -0
- data/samples/processing_app/topics/motion/circle_collision.rb +185 -0
- data/samples/processing_app/topics/motion/cubes_in_cube.rb +64 -0
- data/samples/processing_app/topics/motion/data/java_args.txt +3 -0
- data/samples/processing_app/topics/motion/library/cube/cube.rb +128 -0
- data/samples/processing_app/topics/motion/library/ground/ground.rb +42 -0
- data/samples/processing_app/topics/motion/linear.rb +25 -0
- data/samples/processing_app/topics/motion/morph.rb +84 -0
- data/samples/processing_app/topics/motion/moving_on_curves.rb +46 -0
- data/samples/processing_app/topics/motion/puff.rb +78 -0
- data/samples/processing_app/topics/motion/reflection1.rb +107 -0
- data/samples/processing_app/topics/motion/reflection2.rb +122 -0
- data/samples/processing_app/topics/shaders/README +1 -0
- data/samples/processing_app/topics/shaders/blur_filter.rb +25 -0
- data/samples/processing_app/topics/shaders/bw_shader.rb +40 -0
- data/samples/processing_app/topics/shaders/conway.rb +26 -0
- data/samples/processing_app/topics/shaders/data/GlossyFrag.glsl +44 -0
- data/samples/processing_app/topics/shaders/data/GlossyVert.glsl +33 -0
- data/samples/processing_app/topics/shaders/data/Texture01.jpg +0 -0
- data/samples/processing_app/topics/shaders/data/Texture02.jpg +0 -0
- data/samples/processing_app/topics/shaders/data/ToonFrag.glsl +25 -0
- data/samples/processing_app/topics/shaders/data/ToonVert.glsl +31 -0
- data/samples/processing_app/topics/shaders/data/blur.glsl +42 -0
- data/samples/processing_app/topics/shaders/data/bwfrag.glsl +23 -0
- data/samples/processing_app/topics/shaders/data/conway.glsl +57 -0
- data/samples/processing_app/topics/shaders/data/cubemapfrag.glsl +1 -0
- data/samples/processing_app/topics/shaders/data/cubemapvert.glsl +1 -0
- data/samples/processing_app/topics/shaders/data/deform.glsl +31 -0
- data/samples/processing_app/topics/shaders/data/displaceFrag.glsl +8 -0
- data/samples/processing_app/topics/shaders/data/displaceVert.glsl +201 -0
- data/samples/processing_app/topics/shaders/data/edges.glsl +40 -0
- data/samples/processing_app/topics/shaders/data/java_args.txt +2 -0
- data/samples/processing_app/topics/shaders/data/lachoy.jpg +0 -0
- data/samples/processing_app/topics/shaders/data/landscape.glsl +352 -0
- data/samples/processing_app/topics/shaders/data/leaves.jpg +0 -0
- data/samples/processing_app/topics/shaders/data/mask.glsl +19 -0
- data/samples/processing_app/topics/shaders/data/monjori.glsl +30 -0
- data/samples/processing_app/topics/shaders/data/nebula.glsl +111 -0
- data/samples/processing_app/topics/shaders/data/sep_blur.glsl +59 -0
- data/samples/processing_app/topics/shaders/data/tex1.jpg +0 -0
- data/samples/processing_app/topics/shaders/deform.rb +28 -0
- data/samples/processing_app/topics/shaders/dome_projection.rb +143 -0
- data/samples/processing_app/topics/shaders/edge_detect.rb +30 -0
- data/samples/processing_app/topics/shaders/glossy_fish_eye.rb +63 -0
- data/samples/processing_app/topics/shaders/glsl_heightmap_noise.rb +122 -0
- data/samples/processing_app/topics/shaders/image_mask.rb +31 -0
- data/samples/processing_app/topics/shaders/landscape.rb +32 -0
- data/samples/processing_app/topics/shaders/monjori.rb +28 -0
- data/samples/processing_app/topics/shaders/nebula.rb +18 -0
- data/samples/processing_app/topics/shaders/sep_blur.rb +64 -0
- data/samples/processing_app/topics/shaders/toon_shading.rb +43 -0
- data/samples/processing_app/topics/simulate/README +1 -0
- data/samples/processing_app/topics/simulate/chain.rb +34 -38
- data/samples/processing_app/topics/simulate/data/java_args.txt +2 -0
- data/samples/processing_app/topics/simulate/data/texture.gif +0 -0
- data/samples/processing_app/topics/simulate/data/texture.png +0 -0
- data/samples/processing_app/topics/simulate/flocking.rb +32 -0
- data/samples/processing_app/topics/simulate/library/flock/flock.rb +206 -0
- data/samples/processing_app/topics/simulate/multiple_particle_systems.rb +122 -110
- data/samples/processing_app/topics/simulate/simple_particle_system.rb +63 -86
- data/samples/processing_app/topics/simulate/smoke_particle_system.rb +136 -0
- data/samples/processing_app/topics/simulate/spring.rb +65 -69
- data/samples/processing_app/topics/simulate/springs.rb +35 -36
- data/samples/processing_app/topics/vectors/acceleration_with_vectors.rb +77 -0
- data/samples/processing_app/topics/vectors/bouncing_ball.rb +49 -0
- data/samples/processing_app/topics/vectors/vector_math.rb +38 -0
- data/test/README.md +6 -0
- data/test/basic.rb +14 -0
- data/test/draw_ex.rb +12 -0
- data/test/graphics.rb +7 -0
- data/test/p2d.rb +14 -0
- data/test/p3d.rb +14 -0
- data/test/rp5_test.rb +77 -0
- data/test/setup_ex.rb +12 -0
- data/vendors/Rakefile +36 -0
- metadata +718 -231
- data/README +0 -64
- data/lib/core/core.jar +0 -0
- data/lib/core/jruby-complete.jar +0 -0
- data/lib/ruby-processing/exporters/applet_exporter.rb +0 -78
- data/lib/templates/applet/images/built_with.jpg +0 -0
- data/lib/templates/applet/images/ruby.jpg +0 -0
- data/lib/templates/applet/images/top.png +0 -0
- data/lib/templates/applet/index.html.erb +0 -113
- data/lib/templates/applet/library/library.txt +0 -1
- data/lib/templates/create/bare_sketch.rb.erb +0 -7
- data/library/dxf/library/dxf.jar +0 -0
- data/library/dxf/library/export.txt +0 -1
- data/library/javascript/library/export.txt +0 -8
- data/library/javascript/library/javascript.jar +0 -0
- data/library/minim/library/export.txt +0 -1
- data/library/minim/library/jl1.0.jar +0 -0
- data/library/minim/library/jsminim.jar +0 -0
- data/library/minim/library/minim-spi.jar +0 -0
- data/library/minim/library/minim.jar +0 -0
- data/library/minim/library/mp3spi1.9.4.jar +0 -0
- data/library/minim/library/tritonus_aos.jar +0 -0
- data/library/minim/library/tritonus_share.jar +0 -0
- data/library/net/library/export.txt +0 -1
- data/library/net/library/net.jar +0 -0
- data/library/opengl/library/export.txt +0 -10
- data/library/opengl/library/gluegen-rt.jar +0 -0
- data/library/opengl/library/jogl.jar +0 -0
- data/library/opengl/library/linux32/libgluegen-rt.so +0 -0
- data/library/opengl/library/linux32/libjogl.so +0 -0
- data/library/opengl/library/linux32/libjogl_awt.so +0 -0
- data/library/opengl/library/linux32/libjogl_cg.so +0 -0
- data/library/opengl/library/linux64/libgluegen-rt.so +0 -0
- data/library/opengl/library/linux64/libjogl.so +0 -0
- data/library/opengl/library/linux64/libjogl_awt.so +0 -0
- data/library/opengl/library/linux64/libjogl_cg.so +0 -0
- data/library/opengl/library/macosx/libgluegen-rt.jnilib +0 -0
- data/library/opengl/library/macosx/libjogl.jnilib +0 -0
- data/library/opengl/library/macosx/libjogl_awt.jnilib +0 -0
- data/library/opengl/library/macosx/libjogl_cg.jnilib +0 -0
- data/library/opengl/library/opengl.jar +0 -0
- data/library/opengl/library/windows32/gluegen-rt.dll +0 -0
- data/library/opengl/library/windows32/jogl.dll +0 -0
- data/library/opengl/library/windows32/jogl_awt.dll +0 -0
- data/library/opengl/library/windows32/jogl_cg.dll +0 -0
- data/library/opengl/library/windows64/gluegen-rt.dll +0 -0
- data/library/opengl/library/windows64/jogl.dll +0 -0
- data/library/opengl/library/windows64/jogl_awt.dll +0 -0
- data/library/opengl/library/windows64/jogl_cg.dll +0 -0
- data/library/pdf/library/export.txt +0 -1
- data/library/pdf/library/itext.jar +0 -0
- data/library/pdf/library/pdf.jar +0 -0
- data/library/serial/library/RXTXcomm.jar +0 -0
- data/library/serial/library/export.txt +0 -1
- data/library/serial/library/linux32/librxtxSerial.so +0 -0
- data/library/serial/library/linux64/librxtxSerial.so +0 -0
- data/library/serial/library/macosx/librxtxSerial.jnilib +0 -0
- data/library/serial/library/serial.jar +0 -0
- data/library/serial/library/windows32/rxtxSerial.dll +0 -0
- data/library/serial/library/windows64/rxtxSerial.dll +0 -0
- data/library/video/library/export.txt +0 -1
- data/library/video/library/video.jar +0 -0
- data/samples/anar/data/java_args.txt +0 -1
- data/samples/anar/extrusion.rb +0 -49
- data/samples/anar/l_system.rb +0 -86
- data/samples/anar/library/anar/anar.jar +0 -0
- data/samples/anar/many_shapes.rb +0 -98
- data/samples/peasy_cam/data/java_args.txt +0 -1
- data/samples/peasy_cam/hilbert_fractal.rb +0 -40
- data/samples/peasy_cam/library/PeasyCam/PeasyCam.jar +0 -0
- data/samples/processing_app/3D/camera/move_eye.rb +0 -29
- data/samples/processing_app/3D/camera/ortho_vs_perspective.rb +0 -38
- data/samples/processing_app/3D/form/brick_tower.rb +0 -86
- data/samples/processing_app/3D/form/cubic_grid.rb +0 -51
- data/samples/processing_app/3D/form/rgb_cube.rb +0 -88
- data/samples/processing_app/3D/form/shape_transform.rb +0 -94
- data/samples/processing_app/3D/form/toroid.rb +0 -130
- data/samples/processing_app/3D/form/vertices.rb +0 -81
- data/samples/processing_app/3D/image/explode.rb +0 -56
- data/samples/processing_app/3D/image/extrusion.rb +0 -49
- data/samples/processing_app/3D/image/zoom.rb +0 -83
- data/samples/processing_app/3D/lights/directional.rb +0 -41
- data/samples/processing_app/3D/lights/lights1.rb +0 -39
- data/samples/processing_app/3D/lights/lights2.rb +0 -42
- data/samples/processing_app/3D/lights/reflection.rb +0 -38
- data/samples/processing_app/3D/lights/spot.rb +0 -39
- data/samples/processing_app/3D/textures/texture1.rb +0 -41
- data/samples/processing_app/3D/textures/texture2.rb +0 -38
- data/samples/processing_app/3D/textures/texture3.rb +0 -68
- data/samples/processing_app/3D/textures/texture_cube.rb +0 -106
- data/samples/processing_app/3D/transform/bird.rb +0 -61
- data/samples/processing_app/3D/transform/birds/birds.rb +0 -48
- data/samples/processing_app/3D/transform/cubes_in_cube/cubes_in_cube.rb +0 -102
- data/samples/processing_app/3D/transform/push_pop_cubes.rb +0 -152
- data/samples/processing_app/3D/transform/rotate1.rb +0 -43
- data/samples/processing_app/3D/transform/rotate2.rb +0 -45
- data/samples/processing_app/3D/typography/data/Univers66.vlw.gz +0 -0
- data/samples/processing_app/3D/typography/letter_k.rb +0 -136
- data/samples/processing_app/3D/typography/typing.rb +0 -77
- data/samples/processing_app/basics/data/characters_strings/characters_strings.rb +0 -85
- data/samples/processing_app/basics/data/characters_strings/data/Eureka-90.vlw +0 -0
- data/samples/processing_app/basics/data/characters_strings/data/rathausFrog.jpg +0 -0
- data/samples/processing_app/basics/input/keyboard_2.rb +0 -45
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
:bubbles:
|
3
|
+
- !ruby/struct:BubbleStruct
|
4
|
+
x: 160
|
5
|
+
y: 103
|
6
|
+
diameter: 43.2
|
7
|
+
label: Happy
|
8
|
+
- !ruby/struct:BubbleStruct
|
9
|
+
x: 372
|
10
|
+
y: 137
|
11
|
+
diameter: 52.4
|
12
|
+
label: Sad
|
13
|
+
- !ruby/struct:BubbleStruct
|
14
|
+
x: 273
|
15
|
+
y: 235
|
16
|
+
diameter: 61.0
|
17
|
+
label: Joyous
|
18
|
+
- !ruby/struct:BubbleStruct
|
19
|
+
x: 121
|
20
|
+
y: 179
|
21
|
+
diameter: 44.7
|
22
|
+
label: Melancholy
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# The bubble library, include BubbleStruct
|
2
|
+
|
3
|
+
class Bubble
|
4
|
+
include Processing::Proxy
|
5
|
+
|
6
|
+
attr_reader :x, :y, :diameter, :name, :over
|
7
|
+
|
8
|
+
# Create the Bubble
|
9
|
+
def initialize(x, y, diameter, name)
|
10
|
+
@x = x
|
11
|
+
@y = y
|
12
|
+
@diameter = diameter
|
13
|
+
@name = name
|
14
|
+
@over = false
|
15
|
+
end
|
16
|
+
|
17
|
+
# Checking if mouse is over the Bubble
|
18
|
+
def rollover(px, py)
|
19
|
+
d = dist(px,py,x,y)
|
20
|
+
@over = (d < diameter/2)? true : false
|
21
|
+
end
|
22
|
+
|
23
|
+
# Display the Bubble
|
24
|
+
def display
|
25
|
+
stroke(0)
|
26
|
+
stroke_weight(2)
|
27
|
+
noFill
|
28
|
+
ellipse(x,y,diameter,diameter)
|
29
|
+
if (over)
|
30
|
+
fill(0)
|
31
|
+
text_align(CENTER)
|
32
|
+
text(name, x, y + diameter/2 + 20)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_hash
|
37
|
+
{"position" => {"x" => x, "y" => y}, "diameter" => diameter, "label" => name}
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_struct
|
41
|
+
BubbleStruct.new(x, y, diameter, name)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
BubbleStruct = Struct.new(:x, :y, :diameter, :label)
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#######
|
2
|
+
# word.rb
|
3
|
+
# the word class stores data about words (text, source, frequency)
|
4
|
+
# thanks to processing mixin words are rendered according to
|
5
|
+
# source and frequency
|
6
|
+
########
|
7
|
+
class Word
|
8
|
+
include Processing::Proxy
|
9
|
+
# Store a count for occurences in two different books
|
10
|
+
attr_reader :count_dracula, :count_franken, :total_count, :word, :position, :width, :height, :speed
|
11
|
+
|
12
|
+
def initialize(s)
|
13
|
+
@width, @height = $app.width, $app.height
|
14
|
+
@count_dracula, @count_franken, @total_count = 0, 0, 0
|
15
|
+
@position = [rand(width), rand(-height .. height*2)]
|
16
|
+
@word = s
|
17
|
+
end
|
18
|
+
|
19
|
+
# We will display a word if it appears at least 5 times
|
20
|
+
# and only in one of the books
|
21
|
+
def qualify?
|
22
|
+
return ((count_dracula == total_count || count_franken == total_count) && total_count > 5)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Increment the count for Dracula
|
26
|
+
def increment_dracula
|
27
|
+
@count_dracula += 1
|
28
|
+
@total_count += 1
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
# Increment the count for Frankenstein
|
33
|
+
def increment_franken
|
34
|
+
@count_franken += 1
|
35
|
+
@total_count += 1
|
36
|
+
end
|
37
|
+
|
38
|
+
# The more often it appears, the faster it falls
|
39
|
+
def move
|
40
|
+
@speed = map(total_count, 5, 25, 0.1, 0.4).to_f
|
41
|
+
@speed = constrain(speed, 0, 10.0)
|
42
|
+
@position[Y] += speed
|
43
|
+
|
44
|
+
if (position[Y] > height*2)
|
45
|
+
@position[Y] = -height
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# Depending on which book it gets a color
|
51
|
+
def display
|
52
|
+
if (count_dracula > 0)
|
53
|
+
fill(255)
|
54
|
+
elsif (count_franken > 0)
|
55
|
+
fill(0)
|
56
|
+
end
|
57
|
+
# Its size is also tied to number of occurences
|
58
|
+
fs = map(total_count,5,25,2,24.0).to_f
|
59
|
+
fs = constrain(fs, 2, 48)
|
60
|
+
text_size(fs)
|
61
|
+
text_align(CENTER)
|
62
|
+
text(word, position[X], position[Y])
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
#
|
2
|
+
# Loading XML Data
|
3
|
+
# by Daniel Shiffman.
|
4
|
+
#
|
5
|
+
# This example demonstrates how to use loadXML
|
6
|
+
# to retrieve data from an XML file and make objects
|
7
|
+
# from that data.
|
8
|
+
#
|
9
|
+
# Here is what the XML looks like:
|
10
|
+
#
|
11
|
+
# <?xml version="1.0"?>
|
12
|
+
# <bubbles>
|
13
|
+
# <bubble>
|
14
|
+
# <position x="160" y="103"/>
|
15
|
+
# <diameter>43.19838</diameter>
|
16
|
+
# <label>Happy</label>
|
17
|
+
# </bubble>
|
18
|
+
# <bubble>
|
19
|
+
# <position x="372" y="137"/>
|
20
|
+
# <diameter>52.42526</diameter>
|
21
|
+
# <label>Sad</label>
|
22
|
+
# </bubble>
|
23
|
+
# </bubbles>
|
24
|
+
#
|
25
|
+
load_library "bubble"
|
26
|
+
|
27
|
+
attr_reader :bubbles, :xml
|
28
|
+
|
29
|
+
def setup
|
30
|
+
size(640, 360)
|
31
|
+
load_data
|
32
|
+
end
|
33
|
+
|
34
|
+
def draw
|
35
|
+
background(255)
|
36
|
+
# Display all bubbles
|
37
|
+
bubbles.each do |b|
|
38
|
+
b.display
|
39
|
+
b.rollover(mouseX, mouseY)
|
40
|
+
end
|
41
|
+
|
42
|
+
text_align(LEFT)
|
43
|
+
fill(0)
|
44
|
+
text("Click to add bubbles.", 10, height - 10)
|
45
|
+
end
|
46
|
+
|
47
|
+
def load_data
|
48
|
+
# Load XML file
|
49
|
+
@xml = loadXML("data.xml")
|
50
|
+
# Get all the child nodes named "bubble"
|
51
|
+
children = xml.get_children("bubble")
|
52
|
+
|
53
|
+
# The size of the array of Bubble objects is determined by the total XML elements named "bubble"
|
54
|
+
@bubbles = []
|
55
|
+
|
56
|
+
children.each do |element|
|
57
|
+
# The position element has two attributes: x and y
|
58
|
+
position_element = element.get_child("position")
|
59
|
+
# Note how with attributes we can get an integer or directly
|
60
|
+
x, y = position_element.get_int("x"), position_element.get_int("y")
|
61
|
+
|
62
|
+
# The diameter is the content of the child named "diamater"
|
63
|
+
diameter_element = element.get_child("diameter")
|
64
|
+
# Note how with the content of an XML node, we retrieve as a String and then convert
|
65
|
+
diameter = (diameter_element.get_content).to_f
|
66
|
+
|
67
|
+
# The label is the content of the child named "label"
|
68
|
+
label_element = element.get_child("label")
|
69
|
+
label = label_element.get_content
|
70
|
+
|
71
|
+
# Make a Bubble object out of the data read
|
72
|
+
bubbles << Bubble.new(x, y, diameter, label)
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
# Still need to work on adding and deleting
|
78
|
+
|
79
|
+
def mouse_pressed
|
80
|
+
|
81
|
+
# Create a new XML bubble element
|
82
|
+
bubble = xml.add_child("bubble")
|
83
|
+
|
84
|
+
# Set the poisition element
|
85
|
+
position = bubble.add_child("position")
|
86
|
+
# Here we can set attributes as integers directly
|
87
|
+
position.set_int("x",mouseX)
|
88
|
+
position.set_int("y",mouseY)
|
89
|
+
|
90
|
+
# Set the diameter element
|
91
|
+
diameter = bubble.add_child("diameter")
|
92
|
+
# Here for a node's content, we have to convert to a String
|
93
|
+
diameter.set_content(rand(40.0 .. 80).to_s)
|
94
|
+
|
95
|
+
# Set a label
|
96
|
+
label = bubble.add_child("label")
|
97
|
+
label.set_content("New label")
|
98
|
+
|
99
|
+
|
100
|
+
# Here we are removing the oldest bubble if there are more than 10
|
101
|
+
children = xml.get_children("bubble")
|
102
|
+
# If the XML file has more than 10 bubble elements
|
103
|
+
if (children.length > 10)
|
104
|
+
# Delete the first one
|
105
|
+
xml.remove_child(children[0])
|
106
|
+
end
|
107
|
+
|
108
|
+
# Save a new XML file
|
109
|
+
saveXML(xml,"data/data.xml")
|
110
|
+
|
111
|
+
# reload the new data
|
112
|
+
load_data
|
113
|
+
end
|
114
|
+
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# This example demonstrates how easily "sketch data" can be retrieved from a json file
|
2
|
+
# in ruby-processing. Note this sketch re-uses the Bubble class from the bubble library.
|
3
|
+
# The BubbleData class, can load, store and create instances of Bubble (and request them
|
4
|
+
# to display and/or show their label, when 'mouse over').
|
5
|
+
# @author Martin Prout, after Daniel Shiffmans version for processing
|
6
|
+
#
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
load_library :bubble
|
10
|
+
|
11
|
+
attr_reader :bubble_data
|
12
|
+
|
13
|
+
def setup()
|
14
|
+
size(640, 360)
|
15
|
+
# initialize bubble_data with 'key' and read data from 'file path'
|
16
|
+
@bubble_data = BubbleData.new "bubbles"
|
17
|
+
bubble_data.load_data "data/data.json"
|
18
|
+
end
|
19
|
+
|
20
|
+
def draw
|
21
|
+
background 255
|
22
|
+
# draw the bubbles and display a bubbles label whilst mouse over
|
23
|
+
bubble_data.display mouse_x, mouse_y
|
24
|
+
end
|
25
|
+
|
26
|
+
def mouse_pressed
|
27
|
+
# create a new instance of bubble, where mouse was clicked
|
28
|
+
bubble_data.create_new_bubble(mouse_x, mouse_y)
|
29
|
+
end
|
30
|
+
|
31
|
+
class BubbleData
|
32
|
+
include Enumerable
|
33
|
+
|
34
|
+
MAX_BUBBLE = 10
|
35
|
+
|
36
|
+
attr_reader :key, :path, :bubbles
|
37
|
+
|
38
|
+
# @param key String for top level hash
|
39
|
+
|
40
|
+
def initialize key
|
41
|
+
@key = key
|
42
|
+
@bubbles = []
|
43
|
+
end
|
44
|
+
|
45
|
+
def each &block
|
46
|
+
bubbles.each &block
|
47
|
+
end
|
48
|
+
|
49
|
+
def create_new_bubble x, y
|
50
|
+
self.add Bubble.new(x, y, rand(40 .. 80), "new label")
|
51
|
+
save_data
|
52
|
+
load_data path
|
53
|
+
end
|
54
|
+
|
55
|
+
def display x, y
|
56
|
+
self.each do |bubble|
|
57
|
+
bubble.display
|
58
|
+
bubble.rollover(x, y)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# @param path to json file
|
63
|
+
|
64
|
+
def load_data path
|
65
|
+
@path = path
|
66
|
+
source_string = open(path, "r"){ |file| file.read }
|
67
|
+
data = JSON.parse(source_string)[key]
|
68
|
+
bubbles.clear
|
69
|
+
# iterate the bubble_data array, and create an array of bubbles
|
70
|
+
data.each do |point|
|
71
|
+
self.add Bubble.new(
|
72
|
+
point["position"]["x"],
|
73
|
+
point["position"]["y"],
|
74
|
+
point["diameter"],
|
75
|
+
point["label"])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def add bubble
|
80
|
+
bubbles << bubble
|
81
|
+
bubbles.shift if bubbles.size > MAX_BUBBLE
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def save_data
|
87
|
+
hash = { key => self.map{ |point| point.to_hash } }
|
88
|
+
json = JSON.pretty_generate(hash) # generate pretty output
|
89
|
+
open(path, 'w') { |f| f.write(json) }
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
@@ -0,0 +1,85 @@
|
|
1
|
+
######################################
|
2
|
+
# Yet another examples of reading and
|
3
|
+
# writing to some form of markup,
|
4
|
+
# appropriately yaml using ruby structs
|
5
|
+
# by Martin Prout after Dan Shiffman
|
6
|
+
####################################
|
7
|
+
load_library :bubble
|
8
|
+
|
9
|
+
attr_reader :bubble_data
|
10
|
+
|
11
|
+
|
12
|
+
def setup()
|
13
|
+
size(640, 360)
|
14
|
+
@bubble_data = BubbleData.new :bubbles
|
15
|
+
bubble_data.load_data "data/struct_data.yml"
|
16
|
+
end
|
17
|
+
|
18
|
+
def draw
|
19
|
+
background 255
|
20
|
+
bubble_data.display mouse_x, mouse_y
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def mouse_pressed
|
25
|
+
# create a new bubble instance, where mouse was clicked
|
26
|
+
bubble_data.create_new_bubble(mouse_x, mouse_y)
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
class BubbleData
|
31
|
+
include Enumerable
|
32
|
+
|
33
|
+
MAX_BUBBLE = 10
|
34
|
+
|
35
|
+
attr_reader :path, :bubble_array
|
36
|
+
def initialize key
|
37
|
+
@bubble_array = []
|
38
|
+
@key = key
|
39
|
+
end
|
40
|
+
|
41
|
+
def each &block
|
42
|
+
bubble_array.each &block
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_new_bubble x, y
|
46
|
+
self.add Bubble.new(x, y, rand(40 .. 80), "new label")
|
47
|
+
save_data
|
48
|
+
load_data path
|
49
|
+
end
|
50
|
+
|
51
|
+
def add bubble
|
52
|
+
bubble_array << bubble
|
53
|
+
bubble_array.shift if bubble_array.size > MAX_BUBBLE
|
54
|
+
end
|
55
|
+
|
56
|
+
def load_data path
|
57
|
+
@path = path
|
58
|
+
yaml = Psych.load_file(path)
|
59
|
+
# we are storing the data as an array of RubyStruct, in a hash with
|
60
|
+
# a symbol as the key (the latter only to show we can, it makes no sense)
|
61
|
+
data = yaml[@key]
|
62
|
+
bubble_array.clear
|
63
|
+
# iterate the bubble_data array, and populate the array of bubbles
|
64
|
+
data.each do |pt|
|
65
|
+
self.add Bubble.new(pt.x, pt.y, pt.diameter, pt.label)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def display x, y
|
70
|
+
self.each do |bubble|
|
71
|
+
bubble.display
|
72
|
+
bubble.rollover(x, y)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def save_data
|
79
|
+
hash = { @key => self.map{ |point| point.to_struct } }
|
80
|
+
yaml = hash.to_yaml
|
81
|
+
# overwite existing 'struct_data.yaml'
|
82
|
+
open(path, 'w:UTF-8') {|f| f.write(yaml) }
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#
|
2
|
+
# Loading Tabular Data
|
3
|
+
# after Daniel Shiffman, by Martin Prout.
|
4
|
+
#
|
5
|
+
# This example demonstrates how to use CSV
|
6
|
+
# to retrieve data from a CSV file and make objects
|
7
|
+
# from that data.
|
8
|
+
#
|
9
|
+
# Here is what the CSV looks like:
|
10
|
+
#
|
11
|
+
# x,y,diameter,name
|
12
|
+
# 160,103,43.19838,Happy
|
13
|
+
# 372,137,52.42526,Sad
|
14
|
+
# 273,235,61.14072,Joyous
|
15
|
+
# 121,179,44.758068,Melancholy
|
16
|
+
#
|
17
|
+
require 'csv'
|
18
|
+
|
19
|
+
load_library "bubble"
|
20
|
+
|
21
|
+
attr_reader :bubbles, :data
|
22
|
+
|
23
|
+
def setup
|
24
|
+
size(640, 360)
|
25
|
+
load_data
|
26
|
+
end
|
27
|
+
|
28
|
+
def draw
|
29
|
+
background(255)
|
30
|
+
# Display all bubbles
|
31
|
+
bubbles.each do |b|
|
32
|
+
b.display
|
33
|
+
b.rollover(mouse_x, mouse_y)
|
34
|
+
end
|
35
|
+
|
36
|
+
text_align(LEFT)
|
37
|
+
fill(0)
|
38
|
+
text("Click to add bubbles.", 10, height - 10)
|
39
|
+
end
|
40
|
+
|
41
|
+
def load_data
|
42
|
+
# Load CSV file into an Array of Hash objects
|
43
|
+
# :headers option indicates the file has a header row
|
44
|
+
@data = CSV.read("data/data.csv", :headers => true).map{|row| row.to_hash}
|
45
|
+
|
46
|
+
# The size of the array of Bubble objects is determined by the total number of "rows" in the CSV
|
47
|
+
@bubbles = []
|
48
|
+
|
49
|
+
data.each do |row|
|
50
|
+
# You access the values via their column name (set by using headers option above)
|
51
|
+
x = row["x"].to_f
|
52
|
+
y = row["y"].to_f
|
53
|
+
d = row["diameter"].to_f
|
54
|
+
n = row["name"]
|
55
|
+
# Make a Bubble object out of the data read
|
56
|
+
bubbles << Bubble.new(x, y, d, n)
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
def mouse_pressed
|
62
|
+
# Create a new "row" hash
|
63
|
+
row = {"x" => mouse_x.to_s, "y" => mouse_y.to_s, "diameter" => random(40, 80).to_s, "name" => "Blah"}
|
64
|
+
# add the row to the existing data array
|
65
|
+
data << row
|
66
|
+
|
67
|
+
# If the table has more than 10 rows
|
68
|
+
if (data.size > 10)
|
69
|
+
# Delete the oldest row
|
70
|
+
data.shift
|
71
|
+
end
|
72
|
+
# read column names from data, and generate csv "string" that can be written to file
|
73
|
+
column_names = data.first.keys
|
74
|
+
s = CSV.generate do |csv|
|
75
|
+
csv << column_names
|
76
|
+
data.each do |row|
|
77
|
+
csv << row.values
|
78
|
+
end
|
79
|
+
end
|
80
|
+
# Writing the csv data back to the same file, (also specify UTF-8 format)
|
81
|
+
File.open("data/data.csv", 'w:UTF-8') { |file| file.write(s)}
|
82
|
+
# And reloading it
|
83
|
+
load_data
|
84
|
+
end
|
85
|
+
|