ruby-processing 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +8 -0
- data/lib/patches/JRubyApplet.diff +0 -0
- data/lib/patches/PATCHES.txt +0 -0
- data/lib/patches/PApplet.diff +0 -0
- data/lib/ruby-processing.rb +1 -1
- data/lib/ruby-processing/app.rb +20 -1
- data/lib/ruby-processing/exporters/base_exporter.rb +1 -1
- data/lib/ruby-processing/exporters/creator.rb +1 -2
- data/lib/ruby-processing/runner.rb +4 -3
- data/lib/ruby-processing/runners/watch.rb +2 -2
- data/lib/templates/applet/index.html.erb +1 -1
- metadata +2 -145
- data/samples/learning_processing/ABOUT +0 -11
- data/samples/learning_processing/chapter_01/1_stroke_and_fill.rb +0 -18
- data/samples/learning_processing/chapter_01/2_nofill.rb +0 -20
- data/samples/learning_processing/chapter_01/3_rgb_color.rb +0 -19
- data/samples/learning_processing/chapter_01/4_alpha_transparency.rb +0 -42
- data/samples/learning_processing/chapter_01/5_zoog.rb +0 -24
- data/samples/learning_processing/chapter_02/1_zoog_again.rb +0 -41
- data/samples/learning_processing/chapter_03/1_zoog_as_dynamic_sketch.rb +0 -44
- data/samples/learning_processing/chapter_03/2_mouse_x_and_mouse_y.rb +0 -26
- data/samples/learning_processing/chapter_03/3_zoog_as_dynamic_sketch_with_variation.rb +0 -41
- data/samples/learning_processing/chapter_03/4_drawing_a_continuous_line.rb +0 -18
- data/samples/learning_processing/chapter_03/5_mouse_pressed_and_key_pressed.rb +0 -29
- data/samples/learning_processing/chapter_03/6_interactive_zoog.rb +0 -42
- data/samples/learning_processing/chapter_04/1_variable_declaration.rb +0 -24
- data/samples/learning_processing/chapter_04/2_using_variables.rb +0 -27
- data/samples/learning_processing/chapter_04/3_varying_variables.rb +0 -27
- data/samples/learning_processing/chapter_04/4_many_variables.rb +0 -38
- data/samples/learning_processing/chapter_04/5_using_system_variables.rb +0 -28
- data/samples/learning_processing/chapter_04/6_ellipse_with_variables.rb +0 -24
- data/samples/learning_processing/chapter_04/7_filling_variables_with_random_values.rb +0 -27
- data/samples/learning_processing/chapter_04/8_variable_zoog.rb +0 -50
- data/samples/learning_processing/chapter_05/01_conditionals.rb +0 -31
- data/samples/learning_processing/chapter_05/02_more_conditionals.rb +0 -38
- data/samples/learning_processing/chapter_05/03_rollovers.rb +0 -34
- data/samples/learning_processing/chapter_05/04_hold_down_the_button.rb +0 -33
- data/samples/learning_processing/chapter_05/05_button_as_switch.rb +0 -39
- data/samples/learning_processing/chapter_05/06_bouncing_ball.rb +0 -33
- data/samples/learning_processing/chapter_05/07_bouncing_color.rb +0 -37
- data/samples/learning_processing/chapter_05/08_square_following_edge.rb +0 -59
- data/samples/learning_processing/chapter_05/09_simple_gravity.rb +0 -43
- data/samples/learning_processing/chapter_05/10_zoog_and_conditionals.rb +0 -53
- data/samples/learning_processing/chapter_06/01_many_lines.rb +0 -29
- data/samples/learning_processing/chapter_06/02_many_lines_with_variables.rb +0 -53
- data/samples/learning_processing/chapter_06/03_while_loop.rb +0 -30
- data/samples/learning_processing/chapter_06/04_infinite_loop.rb +0 -25
- data/samples/learning_processing/chapter_06/05_another_infinite_loop.rb +0 -33
- data/samples/learning_processing/chapter_06/06_legs_with_a_for_loop.rb +0 -41
- data/samples/learning_processing/chapter_06/07_local_variables.rb +0 -39
- data/samples/learning_processing/chapter_06/08_lines_one_at_a_time.rb +0 -30
- data/samples/learning_processing/chapter_06/09_simple_while_loop_with_interactivity.rb +0 -41
- data/samples/learning_processing/chapter_06/10_zoog_with_arms.rb +0 -56
- data/samples/learning_processing/chapter_06/11_multiple_zoogs.rb +0 -46
- data/samples/learning_processing/chapter_07/01_defining_a_function.rb +0 -22
- data/samples/learning_processing/chapter_07/02_calling_a_function.rb +0 -22
- data/samples/learning_processing/chapter_07/03_bouncing_ball_with_functions.rb +0 -49
- data/samples/learning_processing/chapter_07/04_function_returns_distance.rb +0 -48
- data/samples/learning_processing/chapter_07/05_zoog_with_functions.rb +0 -71
- data/samples/learning_processing/chapter_08/01_car_class_and_car_variable.rb +0 -45
- data/samples/learning_processing/chapter_08/02_two_car_objects.rb +0 -60
- data/samples/learning_processing/chapter_08/03_object_oriented_zoog.rb +0 -81
- data/samples/learning_processing/chapter_10/01_catcher.rb +0 -35
- data/samples/learning_processing/chapter_10/02_bouncing_ball.rb +0 -44
- data/samples/learning_processing/chapter_10/03_bouncing_balls_with_intersection.rb +0 -69
- data/samples/learning_processing/chapter_10/04_a_timer.rb +0 -24
- data/samples/learning_processing/chapter_10/05_object_oriented_timer.rb +0 -42
- data/samples/learning_processing/chapter_10/06_simple_raindrop.rb +0 -23
- data/samples/learning_processing/chapter_10/07_drops_one_at_a_time.rb +0 -63
- data/samples/learning_processing/chapter_13/02_random_number_distribution.rb +0 -24
- data/samples/learning_processing/chapter_13/03_probabilities.rb +0 -33
- data/samples/learning_processing/chapter_13/04_perlin_noise.rb +0 -22
- data/samples/learning_processing/chapter_13/06_oscillation.rb +0 -29
- data/samples/learning_processing/chapter_13/07_wave.rb +0 -31
- data/samples/learning_processing/chapter_13/08_recursion.rb +0 -30
- data/samples/learning_processing/chapter_13/09_two_dimensional_array.rb +0 -21
- data/samples/learning_processing/chapter_13/10_two_dimensional_array_with_objects.rb +0 -54
- data/samples/learning_processing/chapter_14/01_growing_rectangle.rb +0 -26
- data/samples/learning_processing/chapter_14/02_multiple_translations.rb +0 -37
- data/samples/learning_processing/chapter_14/03_depth_rectangle.rb +0 -29
- data/samples/learning_processing/chapter_14/04_pyramid_using_beingshape.rb +0 -55
- data/samples/learning_processing/chapter_14/05_rotate_rectangle_around_center.rb +0 -28
- data/samples/learning_processing/chapter_14/06_rotate_z.rb +0 -24
- data/samples/learning_processing/chapter_14/07_rotate_x.rb +0 -24
- data/samples/learning_processing/chapter_14/08_rotate_y.rb +0 -24
- data/samples/learning_processing/chapter_14/09_rotate_all.rb +0 -24
- data/samples/learning_processing/chapter_14/10_draw_pyramid.rb +0 -59
- data/samples/learning_processing/chapter_14/12_rotating_one_square.rb +0 -25
- data/samples/learning_processing/chapter_14/13_rotating_another_square.rb +0 -25
- data/samples/learning_processing/chapter_14/14_rotating_both_squares.rb +0 -43
- data/samples/learning_processing/chapter_14/15_rotating_many_things.rb +0 -56
- data/samples/learning_processing/chapter_14/16_simple_solar_system.rb +0 -53
- data/samples/learning_processing/chapter_14/17_nested_push_and_pop.rb +0 -50
- data/samples/learning_processing/chapter_14/18_object_oriented_solar_system.rb +0 -69
- data/samples/learning_processing/chapter_15/01_hello_world_image.rb +0 -20
- data/samples/learning_processing/chapter_15/02_image_sprite.rb +0 -29
- data/samples/learning_processing/chapter_15/03_swapping_images.rb +0 -25
- data/samples/learning_processing/chapter_15/04_image_sequence.rb +0 -22
- data/samples/learning_processing/chapter_15/05_setting_pixels.rb +0 -19
- data/samples/learning_processing/chapter_15/06_pixels_2d.rb +0 -29
- data/samples/learning_processing/chapter_15/07_image_pixels.rb +0 -40
- data/samples/learning_processing/chapter_15/08_image_brightness.rb +0 -29
- data/samples/learning_processing/chapter_15/09_flashlight_effect.rb +0 -42
- data/samples/learning_processing/chapter_15/10_brightness_threshold.rb +0 -33
- data/samples/learning_processing/chapter_15/11_brightness_threshold_with_filter.rb +0 -20
- data/samples/learning_processing/chapter_15/12_pixel_neighbour_differences.rb +0 -43
- data/samples/learning_processing/chapter_15/14_pointillism.rb +0 -34
- data/samples/learning_processing/chapter_15/15_2d_image_mapped_to_3d.rb +0 -43
- data/samples/learning_processing/chapter_15/data/animal0.jpg +0 -0
- data/samples/learning_processing/chapter_15/data/animal1.jpg +0 -0
- data/samples/learning_processing/chapter_15/data/animal2.jpg +0 -0
- data/samples/learning_processing/chapter_15/data/animal3.jpg +0 -0
- data/samples/learning_processing/chapter_15/data/animal4.jpg +0 -0
- data/samples/learning_processing/chapter_15/data/animal5.jpg +0 -0
- data/samples/learning_processing/chapter_15/data/animal6.jpg +0 -0
- data/samples/learning_processing/chapter_15/data/face.jpg +0 -0
- data/samples/learning_processing/chapter_15/data/mysummervacation.jpg +0 -0
- data/samples/learning_processing/chapter_15/data/sunflower.jpg +0 -0
- data/samples/learning_processing/chapter_16/01_display_video.rb +0 -25
- data/samples/learning_processing/chapter_16/02_manipulate_video_image.rb +0 -24
- data/samples/learning_processing/chapter_16/03_adjust_video_brightness.rb +0 -49
- data/samples/learning_processing/chapter_17/01_simple_displaying_text.rb +0 -14
- data/samples/learning_processing/chapter_17/02_text_align.rb +0 -21
- data/samples/learning_processing/chapter_17/03_scrolling_headlines.rb +0 -35
- data/samples/learning_processing/chapter_17/04_text_mirror.rb +0 -68
- data/samples/learning_processing/chapter_17/05_rotating_text.rb +0 -22
- data/samples/learning_processing/chapter_17/06_text_breaking_up.rb +0 -73
- data/samples/learning_processing/chapter_17/07_boxes_along_a_curve.rb +0 -49
- data/samples/learning_processing/chapter_17/08_characters_along_a_curve.rb +0 -51
- data/samples/learning_processing/chapter_17/data/ArialMT-16.vlw +0 -0
- data/samples/learning_processing/chapter_17/data/Courier-Bold-20.vlw +0 -0
- data/samples/learning_processing/chapter_18/01_user_input.rb +0 -39
- data/samples/learning_processing/chapter_18/02_graphing_comma_separated_numbers_from_a_text_file.rb +0 -28
- data/samples/learning_processing/chapter_18/03_creating_object_from_a_text_file.rb +0 -64
- data/samples/learning_processing/chapter_18/data/data-1.txt +0 -1
- data/samples/learning_processing/chapter_18/data/data-2.txt +0 -10
data/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
v1.0.5 Spring Cleaning...
|
2
|
+
* The "Learning Processing" examples are now a separate project, a
|
3
|
+
long-merited change. They'll grow up on their own at
|
4
|
+
http://github.com/jashkenas/learning-processing-with-ruby
|
5
|
+
* The watcher is now a bit better about catching recoverable exceptions.
|
6
|
+
* load_strings and save_strings methods have been added to Processing::App.
|
7
|
+
* Fixing a permissions problem with applet/application exporting.
|
8
|
+
|
1
9
|
v1.0.4 Bare is Beautiful...
|
2
10
|
* Ruby-Processing now supports "bare" sketches, which are sketches that
|
3
11
|
consist of only setup and draw methods, or sketches that contain no method
|
File without changes
|
data/lib/patches/PATCHES.txt
CHANGED
File without changes
|
data/lib/patches/PApplet.diff
CHANGED
File without changes
|
data/lib/ruby-processing.rb
CHANGED
@@ -14,7 +14,7 @@ require 'ruby-processing/helpers/numeric'
|
|
14
14
|
|
15
15
|
# The top-level namespace, a home for all Ruby-Processing classes.
|
16
16
|
module Processing
|
17
|
-
VERSION = [1,0,
|
17
|
+
VERSION = [1,0,5] unless defined? Processing::VERSION
|
18
18
|
|
19
19
|
# Returns the current version of Ruby-Processing.
|
20
20
|
def self.version
|
data/lib/ruby-processing/app.rb
CHANGED
@@ -42,7 +42,7 @@ module Processing
|
|
42
42
|
:mouse_released => :mouseReleased,
|
43
43
|
:key_pressed => :keyPressed,
|
44
44
|
:key_released => :keyReleased,
|
45
|
-
:key_typed => :keyTyped
|
45
|
+
:key_typed => :keyTyped
|
46
46
|
}
|
47
47
|
|
48
48
|
# Override the default width and height to make them a little larger.
|
@@ -259,6 +259,12 @@ module Processing
|
|
259
259
|
int = @declared_fields['key'].value(java_self)
|
260
260
|
int < 256 ? int.chr : int
|
261
261
|
end
|
262
|
+
|
263
|
+
|
264
|
+
# Get the sketch path
|
265
|
+
def sketch_path
|
266
|
+
@declared_fields['sketchPath'].value(java_self)
|
267
|
+
end
|
262
268
|
|
263
269
|
|
264
270
|
# From ROP. Turns a color hash-string into hexadecimal, for Processing.
|
@@ -275,6 +281,19 @@ module Processing
|
|
275
281
|
def frame_count; frameCount; end
|
276
282
|
def mouse_button; mouseButton; end
|
277
283
|
def key_code; keyCode; end
|
284
|
+
|
285
|
+
|
286
|
+
# Ensure that load_strings returns a real Ruby array
|
287
|
+
def load_strings(file_or_url)
|
288
|
+
loadStrings(file_or_url).to_a
|
289
|
+
end
|
290
|
+
|
291
|
+
|
292
|
+
# Writes an array of strings to a file, one line per string.
|
293
|
+
# This file is saved to the sketch's data folder
|
294
|
+
def save_strings(filename, strings)
|
295
|
+
saveStrings(filename, [strings].flatten.to_java(:String))
|
296
|
+
end
|
278
297
|
|
279
298
|
|
280
299
|
# frame_rate needs to support reading and writing
|
@@ -8,7 +8,7 @@ module Processing
|
|
8
8
|
class BaseExporter
|
9
9
|
include FileUtils
|
10
10
|
|
11
|
-
DEFAULT_DIMENSIONS = {'width' =>
|
11
|
+
DEFAULT_DIMENSIONS = {'width' => 200, 'height' => 200}
|
12
12
|
DEFAULT_DESCRIPTION = ''
|
13
13
|
|
14
14
|
# Returns the filepath, basename, and directory name of the sketch.
|
@@ -6,7 +6,7 @@ module Processing
|
|
6
6
|
ALL_DIGITS = /\A\d+\Z/
|
7
7
|
|
8
8
|
# Create a blank sketch, given a path.
|
9
|
-
def create!(path, args)
|
9
|
+
def create!(path, args, bare)
|
10
10
|
usage path
|
11
11
|
main_file = File.basename(path, ".rb")
|
12
12
|
# Check to make sure that the main file exists
|
@@ -21,7 +21,6 @@ module Processing
|
|
21
21
|
@file_name = main_file.underscore
|
22
22
|
@title = main_file.titleize
|
23
23
|
|
24
|
-
bare = !!args.delete('--bare')
|
25
24
|
@width, @height = args[0], args[1]
|
26
25
|
@with_size = @width && @width.match(ALL_DIGITS) &&
|
27
26
|
@height && @height.match(ALL_DIGITS)
|
@@ -39,7 +39,7 @@ module Processing
|
|
39
39
|
case @options.action
|
40
40
|
when 'run' then run(@options.path)
|
41
41
|
when 'watch' then watch(@options.path)
|
42
|
-
when 'create' then create(@options.path, @options.args)
|
42
|
+
when 'create' then create(@options.path, @options.args, @options.bare)
|
43
43
|
when 'live' then live(@options.path)
|
44
44
|
when 'app' then app(@options.path)
|
45
45
|
when 'applet' then applet(@options.path)
|
@@ -54,6 +54,7 @@ module Processing
|
|
54
54
|
# Parse the command-line options. Keep it simple.
|
55
55
|
def parse_options(args)
|
56
56
|
@options = OpenStruct.new
|
57
|
+
@options.bare = !!args.delete('--bare')
|
57
58
|
@options.action = args[0] || nil
|
58
59
|
@options.path = args[1] || File.basename(Dir.pwd + '.rb')
|
59
60
|
@options.args = args[2..-1] || []
|
@@ -61,8 +62,8 @@ module Processing
|
|
61
62
|
|
62
63
|
# Create a fresh Ruby-Processing sketch, with the necessary
|
63
64
|
# boilerplate filled out.
|
64
|
-
def create(sketch, args)
|
65
|
-
Processing::Creator.new.create!(sketch, args)
|
65
|
+
def create(sketch, args, bare)
|
66
|
+
Processing::Creator.new.create!(sketch, args, bare)
|
66
67
|
end
|
67
68
|
|
68
69
|
# Just simply run a ruby-processing sketch.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-processing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Ashkenas
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2009-03-
|
20
|
+
date: 2009-03-28 00:00:00 -04:00
|
21
21
|
default_executable: rp5
|
22
22
|
dependencies: []
|
23
23
|
|
@@ -185,149 +185,6 @@ files:
|
|
185
185
|
- samples/full_screen.rb
|
186
186
|
- samples/getting_started.rb
|
187
187
|
- samples/jwishy.rb
|
188
|
-
- samples/learning_processing
|
189
|
-
- samples/learning_processing/ABOUT
|
190
|
-
- samples/learning_processing/chapter_01
|
191
|
-
- samples/learning_processing/chapter_01/1_stroke_and_fill.rb
|
192
|
-
- samples/learning_processing/chapter_01/2_nofill.rb
|
193
|
-
- samples/learning_processing/chapter_01/3_rgb_color.rb
|
194
|
-
- samples/learning_processing/chapter_01/4_alpha_transparency.rb
|
195
|
-
- samples/learning_processing/chapter_01/5_zoog.rb
|
196
|
-
- samples/learning_processing/chapter_02
|
197
|
-
- samples/learning_processing/chapter_02/1_zoog_again.rb
|
198
|
-
- samples/learning_processing/chapter_03
|
199
|
-
- samples/learning_processing/chapter_03/1_zoog_as_dynamic_sketch.rb
|
200
|
-
- samples/learning_processing/chapter_03/2_mouse_x_and_mouse_y.rb
|
201
|
-
- samples/learning_processing/chapter_03/3_zoog_as_dynamic_sketch_with_variation.rb
|
202
|
-
- samples/learning_processing/chapter_03/4_drawing_a_continuous_line.rb
|
203
|
-
- samples/learning_processing/chapter_03/5_mouse_pressed_and_key_pressed.rb
|
204
|
-
- samples/learning_processing/chapter_03/6_interactive_zoog.rb
|
205
|
-
- samples/learning_processing/chapter_04
|
206
|
-
- samples/learning_processing/chapter_04/1_variable_declaration.rb
|
207
|
-
- samples/learning_processing/chapter_04/2_using_variables.rb
|
208
|
-
- samples/learning_processing/chapter_04/3_varying_variables.rb
|
209
|
-
- samples/learning_processing/chapter_04/4_many_variables.rb
|
210
|
-
- samples/learning_processing/chapter_04/5_using_system_variables.rb
|
211
|
-
- samples/learning_processing/chapter_04/6_ellipse_with_variables.rb
|
212
|
-
- samples/learning_processing/chapter_04/7_filling_variables_with_random_values.rb
|
213
|
-
- samples/learning_processing/chapter_04/8_variable_zoog.rb
|
214
|
-
- samples/learning_processing/chapter_05
|
215
|
-
- samples/learning_processing/chapter_05/01_conditionals.rb
|
216
|
-
- samples/learning_processing/chapter_05/02_more_conditionals.rb
|
217
|
-
- samples/learning_processing/chapter_05/03_rollovers.rb
|
218
|
-
- samples/learning_processing/chapter_05/04_hold_down_the_button.rb
|
219
|
-
- samples/learning_processing/chapter_05/05_button_as_switch.rb
|
220
|
-
- samples/learning_processing/chapter_05/06_bouncing_ball.rb
|
221
|
-
- samples/learning_processing/chapter_05/07_bouncing_color.rb
|
222
|
-
- samples/learning_processing/chapter_05/08_square_following_edge.rb
|
223
|
-
- samples/learning_processing/chapter_05/09_simple_gravity.rb
|
224
|
-
- samples/learning_processing/chapter_05/10_zoog_and_conditionals.rb
|
225
|
-
- samples/learning_processing/chapter_06
|
226
|
-
- samples/learning_processing/chapter_06/01_many_lines.rb
|
227
|
-
- samples/learning_processing/chapter_06/02_many_lines_with_variables.rb
|
228
|
-
- samples/learning_processing/chapter_06/03_while_loop.rb
|
229
|
-
- samples/learning_processing/chapter_06/04_infinite_loop.rb
|
230
|
-
- samples/learning_processing/chapter_06/05_another_infinite_loop.rb
|
231
|
-
- samples/learning_processing/chapter_06/06_legs_with_a_for_loop.rb
|
232
|
-
- samples/learning_processing/chapter_06/07_local_variables.rb
|
233
|
-
- samples/learning_processing/chapter_06/08_lines_one_at_a_time.rb
|
234
|
-
- samples/learning_processing/chapter_06/09_simple_while_loop_with_interactivity.rb
|
235
|
-
- samples/learning_processing/chapter_06/10_zoog_with_arms.rb
|
236
|
-
- samples/learning_processing/chapter_06/11_multiple_zoogs.rb
|
237
|
-
- samples/learning_processing/chapter_07
|
238
|
-
- samples/learning_processing/chapter_07/01_defining_a_function.rb
|
239
|
-
- samples/learning_processing/chapter_07/02_calling_a_function.rb
|
240
|
-
- samples/learning_processing/chapter_07/03_bouncing_ball_with_functions.rb
|
241
|
-
- samples/learning_processing/chapter_07/04_function_returns_distance.rb
|
242
|
-
- samples/learning_processing/chapter_07/05_zoog_with_functions.rb
|
243
|
-
- samples/learning_processing/chapter_08
|
244
|
-
- samples/learning_processing/chapter_08/01_car_class_and_car_variable.rb
|
245
|
-
- samples/learning_processing/chapter_08/02_two_car_objects.rb
|
246
|
-
- samples/learning_processing/chapter_08/03_object_oriented_zoog.rb
|
247
|
-
- samples/learning_processing/chapter_10
|
248
|
-
- samples/learning_processing/chapter_10/01_catcher.rb
|
249
|
-
- samples/learning_processing/chapter_10/02_bouncing_ball.rb
|
250
|
-
- samples/learning_processing/chapter_10/03_bouncing_balls_with_intersection.rb
|
251
|
-
- samples/learning_processing/chapter_10/04_a_timer.rb
|
252
|
-
- samples/learning_processing/chapter_10/05_object_oriented_timer.rb
|
253
|
-
- samples/learning_processing/chapter_10/06_simple_raindrop.rb
|
254
|
-
- samples/learning_processing/chapter_10/07_drops_one_at_a_time.rb
|
255
|
-
- samples/learning_processing/chapter_13
|
256
|
-
- samples/learning_processing/chapter_13/02_random_number_distribution.rb
|
257
|
-
- samples/learning_processing/chapter_13/03_probabilities.rb
|
258
|
-
- samples/learning_processing/chapter_13/04_perlin_noise.rb
|
259
|
-
- samples/learning_processing/chapter_13/06_oscillation.rb
|
260
|
-
- samples/learning_processing/chapter_13/07_wave.rb
|
261
|
-
- samples/learning_processing/chapter_13/08_recursion.rb
|
262
|
-
- samples/learning_processing/chapter_13/09_two_dimensional_array.rb
|
263
|
-
- samples/learning_processing/chapter_13/10_two_dimensional_array_with_objects.rb
|
264
|
-
- samples/learning_processing/chapter_14
|
265
|
-
- samples/learning_processing/chapter_14/01_growing_rectangle.rb
|
266
|
-
- samples/learning_processing/chapter_14/02_multiple_translations.rb
|
267
|
-
- samples/learning_processing/chapter_14/03_depth_rectangle.rb
|
268
|
-
- samples/learning_processing/chapter_14/04_pyramid_using_beingshape.rb
|
269
|
-
- samples/learning_processing/chapter_14/05_rotate_rectangle_around_center.rb
|
270
|
-
- samples/learning_processing/chapter_14/06_rotate_z.rb
|
271
|
-
- samples/learning_processing/chapter_14/07_rotate_x.rb
|
272
|
-
- samples/learning_processing/chapter_14/08_rotate_y.rb
|
273
|
-
- samples/learning_processing/chapter_14/09_rotate_all.rb
|
274
|
-
- samples/learning_processing/chapter_14/10_draw_pyramid.rb
|
275
|
-
- samples/learning_processing/chapter_14/12_rotating_one_square.rb
|
276
|
-
- samples/learning_processing/chapter_14/13_rotating_another_square.rb
|
277
|
-
- samples/learning_processing/chapter_14/14_rotating_both_squares.rb
|
278
|
-
- samples/learning_processing/chapter_14/15_rotating_many_things.rb
|
279
|
-
- samples/learning_processing/chapter_14/16_simple_solar_system.rb
|
280
|
-
- samples/learning_processing/chapter_14/17_nested_push_and_pop.rb
|
281
|
-
- samples/learning_processing/chapter_14/18_object_oriented_solar_system.rb
|
282
|
-
- samples/learning_processing/chapter_15
|
283
|
-
- samples/learning_processing/chapter_15/01_hello_world_image.rb
|
284
|
-
- samples/learning_processing/chapter_15/02_image_sprite.rb
|
285
|
-
- samples/learning_processing/chapter_15/03_swapping_images.rb
|
286
|
-
- samples/learning_processing/chapter_15/04_image_sequence.rb
|
287
|
-
- samples/learning_processing/chapter_15/05_setting_pixels.rb
|
288
|
-
- samples/learning_processing/chapter_15/06_pixels_2d.rb
|
289
|
-
- samples/learning_processing/chapter_15/07_image_pixels.rb
|
290
|
-
- samples/learning_processing/chapter_15/08_image_brightness.rb
|
291
|
-
- samples/learning_processing/chapter_15/09_flashlight_effect.rb
|
292
|
-
- samples/learning_processing/chapter_15/10_brightness_threshold.rb
|
293
|
-
- samples/learning_processing/chapter_15/11_brightness_threshold_with_filter.rb
|
294
|
-
- samples/learning_processing/chapter_15/12_pixel_neighbour_differences.rb
|
295
|
-
- samples/learning_processing/chapter_15/14_pointillism.rb
|
296
|
-
- samples/learning_processing/chapter_15/15_2d_image_mapped_to_3d.rb
|
297
|
-
- samples/learning_processing/chapter_15/data
|
298
|
-
- samples/learning_processing/chapter_15/data/animal0.jpg
|
299
|
-
- samples/learning_processing/chapter_15/data/animal1.jpg
|
300
|
-
- samples/learning_processing/chapter_15/data/animal2.jpg
|
301
|
-
- samples/learning_processing/chapter_15/data/animal3.jpg
|
302
|
-
- samples/learning_processing/chapter_15/data/animal4.jpg
|
303
|
-
- samples/learning_processing/chapter_15/data/animal5.jpg
|
304
|
-
- samples/learning_processing/chapter_15/data/animal6.jpg
|
305
|
-
- samples/learning_processing/chapter_15/data/face.jpg
|
306
|
-
- samples/learning_processing/chapter_15/data/mysummervacation.jpg
|
307
|
-
- samples/learning_processing/chapter_15/data/sunflower.jpg
|
308
|
-
- samples/learning_processing/chapter_16
|
309
|
-
- samples/learning_processing/chapter_16/01_display_video.rb
|
310
|
-
- samples/learning_processing/chapter_16/02_manipulate_video_image.rb
|
311
|
-
- samples/learning_processing/chapter_16/03_adjust_video_brightness.rb
|
312
|
-
- samples/learning_processing/chapter_17
|
313
|
-
- samples/learning_processing/chapter_17/01_simple_displaying_text.rb
|
314
|
-
- samples/learning_processing/chapter_17/02_text_align.rb
|
315
|
-
- samples/learning_processing/chapter_17/03_scrolling_headlines.rb
|
316
|
-
- samples/learning_processing/chapter_17/04_text_mirror.rb
|
317
|
-
- samples/learning_processing/chapter_17/05_rotating_text.rb
|
318
|
-
- samples/learning_processing/chapter_17/06_text_breaking_up.rb
|
319
|
-
- samples/learning_processing/chapter_17/07_boxes_along_a_curve.rb
|
320
|
-
- samples/learning_processing/chapter_17/08_characters_along_a_curve.rb
|
321
|
-
- samples/learning_processing/chapter_17/data
|
322
|
-
- samples/learning_processing/chapter_17/data/ArialMT-16.vlw
|
323
|
-
- samples/learning_processing/chapter_17/data/Courier-Bold-20.vlw
|
324
|
-
- samples/learning_processing/chapter_18
|
325
|
-
- samples/learning_processing/chapter_18/01_user_input.rb
|
326
|
-
- samples/learning_processing/chapter_18/02_graphing_comma_separated_numbers_from_a_text_file.rb
|
327
|
-
- samples/learning_processing/chapter_18/03_creating_object_from_a_text_file.rb
|
328
|
-
- samples/learning_processing/chapter_18/data
|
329
|
-
- samples/learning_processing/chapter_18/data/data-1.txt
|
330
|
-
- samples/learning_processing/chapter_18/data/data-2.txt
|
331
188
|
- samples/orbit.rb
|
332
189
|
- samples/processing_app
|
333
190
|
- samples/processing_app/3D
|
@@ -1,11 +0,0 @@
|
|
1
|
-
"Learning Processing" is a 2008 book that serves as a gentle
|
2
|
-
introduction to the theory and practice of programming. It
|
3
|
-
works by introducing code concepts over the course of 23
|
4
|
-
chapters, and creating a series of examples that build on
|
5
|
-
the sketches that you write over the course of the book.
|
6
|
-
|
7
|
-
"Learning Processing" is written by Daniel Shiffman of the
|
8
|
-
ITP in New York City.
|
9
|
-
|
10
|
-
More information about the book can be found at:
|
11
|
-
http://www.learningprocessing.com/
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This is the simplest form of a Ruby-Processing sketch. A simple sequence
|
2
|
-
# of instructions that are run a single time to paint a picture.
|
3
|
-
|
4
|
-
# Stretch the canvas to 200 pixels wide by 200 pixels tall.
|
5
|
-
size 200, 200
|
6
|
-
|
7
|
-
# Paint the background white.
|
8
|
-
background 255
|
9
|
-
|
10
|
-
# Set the color of strokes to black.
|
11
|
-
stroke 0
|
12
|
-
|
13
|
-
# Set the color of fills to middle gray.
|
14
|
-
fill 150
|
15
|
-
|
16
|
-
# Draw a rectangle 50 pixels over and 50 pixels down from the top left corner,
|
17
|
-
# with a width of 75 pixels and a height of 100.
|
18
|
-
rect 50, 50, 75, 100
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# Here we introduce a slightly more sophisticated version of a Ruby-Processing
|
2
|
-
# sketch. The code inside of the setup is run a single time, at the beginning.
|
3
|
-
def setup
|
4
|
-
size 200, 200
|
5
|
-
smooth
|
6
|
-
background 255
|
7
|
-
# In Ruby, methods and variables are under_scored instead of camelCased
|
8
|
-
no_fill
|
9
|
-
stroke 0
|
10
|
-
# You might notice that there are no parenthesis or semicolons.
|
11
|
-
# That's because they're optional.
|
12
|
-
ellipse 60, 60, 100, 100
|
13
|
-
# This line works too:
|
14
|
-
ellipse(60, 60, 100, 100);
|
15
|
-
end
|
16
|
-
|
17
|
-
# And the code inside of draw, if there were any, would be drawn over and over.
|
18
|
-
def draw
|
19
|
-
|
20
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# RGB color is specified by intensity of red, then green, then blue.
|
2
|
-
|
3
|
-
size 200, 200
|
4
|
-
smooth
|
5
|
-
|
6
|
-
background 255
|
7
|
-
no_stroke
|
8
|
-
|
9
|
-
# Bright red
|
10
|
-
fill 255, 0, 0
|
11
|
-
ellipse 20, 20, 16, 16
|
12
|
-
|
13
|
-
# Dark red
|
14
|
-
fill 127, 0, 0
|
15
|
-
ellipse 40, 20, 16, 16
|
16
|
-
|
17
|
-
# Pink
|
18
|
-
fill 255, 200, 200
|
19
|
-
ellipse 60, 20, 16, 16
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# This sketch introduces the fuller version of a Ruby-Processing sketch,
|
2
|
-
# and demonstrates what's really going on behind the scenes when you make
|
3
|
-
# one of the simpler sketches, with just a setup method.
|
4
|
-
|
5
|
-
# A sketch is a class that inherits from the Processing::App, which works
|
6
|
-
# very much along the lines of a PApplet in Processing.
|
7
|
-
class AlphaTransparency < Processing::App
|
8
|
-
|
9
|
-
def setup
|
10
|
-
background 0
|
11
|
-
no_stroke
|
12
|
-
|
13
|
-
# No fourth argument means 100% opacity
|
14
|
-
fill 0, 0, 255
|
15
|
-
rect 0, 0, 100, 200
|
16
|
-
|
17
|
-
# 255 means 100% opacity
|
18
|
-
fill 255, 0, 0, 255
|
19
|
-
rect 0, 0, 200, 40
|
20
|
-
|
21
|
-
# 75% opacity
|
22
|
-
fill 255, 0, 0, 191
|
23
|
-
rect 0, 50, 200, 40
|
24
|
-
|
25
|
-
# 55% opacity
|
26
|
-
fill 200, 0, 0, 127
|
27
|
-
rect 0, 100, 200, 40
|
28
|
-
|
29
|
-
# 25% opacity
|
30
|
-
fill 255, 0, 0, 63
|
31
|
-
rect 0, 150, 200, 40
|
32
|
-
end
|
33
|
-
|
34
|
-
def draw
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
# After defining your sketch, you create one.
|
41
|
-
# If you prefer, you may set the width, height, and title as you create it.
|
42
|
-
AlphaTransparency.new :title => "Alpha Transparency", :width => 200, :height => 200
|
@@ -1,24 +0,0 @@
|
|
1
|
-
size 200, 200
|
2
|
-
background 255
|
3
|
-
smooth
|
4
|
-
ellipse_mode CENTER
|
5
|
-
rect_mode CENTER
|
6
|
-
|
7
|
-
# Body
|
8
|
-
stroke 0
|
9
|
-
fill 150
|
10
|
-
rect 100, 100, 20, 100
|
11
|
-
|
12
|
-
# Head
|
13
|
-
fill 255
|
14
|
-
ellipse 100, 70, 60, 60
|
15
|
-
|
16
|
-
# Eyes
|
17
|
-
fill 0
|
18
|
-
ellipse 81, 70, 16, 32
|
19
|
-
ellipse 119, 70, 16, 32
|
20
|
-
|
21
|
-
# Legs
|
22
|
-
stroke 0
|
23
|
-
line 90, 150, 80, 160
|
24
|
-
line 110, 150, 120, 160
|