ruby-processing 1.0.9 → 1.0.10.1

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.
Files changed (193) hide show
  1. data/CHANGELOG +13 -1
  2. data/bin/rp5 +8 -2
  3. data/lib/core/core.jar +0 -0
  4. data/lib/core/jruby-complete.jar +0 -0
  5. data/lib/ruby-processing.rb +2 -2
  6. data/lib/ruby-processing/app.rb +108 -338
  7. data/lib/ruby-processing/config.rb +6 -0
  8. data/lib/ruby-processing/helper_methods.rb +120 -0
  9. data/lib/ruby-processing/library_loader.rb +140 -0
  10. data/lib/ruby-processing/runner.rb +34 -4
  11. data/lib/ruby-processing/runners/base.rb +10 -11
  12. data/lib/ruby-processing/runners/live.rb +1 -1
  13. data/lib/ruby-processing/runners/run.rb +1 -1
  14. data/lib/ruby-processing/runners/watch.rb +18 -76
  15. data/lib/templates/applet/index.html.erb +8 -9
  16. data/library/control_panel/control_panel.rb +1 -1
  17. data/library/dxf/library/dxf.jar +0 -0
  18. data/library/dxf/library/export.txt +1 -0
  19. data/library/javascript/library/export.txt +3 -1
  20. data/library/minim/library/export.txt +1 -0
  21. data/library/minim/library/jl1.0.jar +0 -0
  22. data/library/minim/library/jsminim.jar +0 -0
  23. data/library/minim/library/minim-spi.jar +0 -0
  24. data/library/minim/library/minim.jar +0 -0
  25. data/library/minim/library/mp3spi1.9.4.jar +0 -0
  26. data/library/minim/library/tritonus_aos.jar +0 -0
  27. data/library/minim/library/tritonus_share.jar +0 -0
  28. data/library/net/library/export.txt +1 -0
  29. data/library/net/library/net.jar +0 -0
  30. data/library/opengl/library/export.txt +7 -10
  31. data/library/opengl/library/gluegen-rt.jar +0 -0
  32. data/library/opengl/library/jogl.jar +0 -0
  33. data/library/opengl/library/{libgluegen-rt.so → linux32/libgluegen-rt.so} +0 -0
  34. data/library/opengl/library/{libjogl.so → linux32/libjogl.so} +0 -0
  35. data/library/opengl/library/{libjogl_awt.so → linux32/libjogl_awt.so} +0 -0
  36. data/library/opengl/library/{libjogl_cg.so → linux32/libjogl_cg.so} +0 -0
  37. data/library/opengl/library/linux64/libgluegen-rt.so +0 -0
  38. data/library/opengl/library/linux64/libjogl.so +0 -0
  39. data/library/opengl/library/linux64/libjogl_awt.so +0 -0
  40. data/library/opengl/library/linux64/libjogl_cg.so +0 -0
  41. data/library/opengl/library/{libgluegen-rt.jnilib → macosx/libgluegen-rt.jnilib} +0 -0
  42. data/library/opengl/library/{libjogl.jnilib → macosx/libjogl.jnilib} +0 -0
  43. data/library/opengl/library/{libjogl_awt.jnilib → macosx/libjogl_awt.jnilib} +0 -0
  44. data/library/opengl/library/{libjogl_cg.jnilib → macosx/libjogl_cg.jnilib} +0 -0
  45. data/library/opengl/library/opengl.jar +0 -0
  46. data/library/opengl/library/{gluegen-rt.dll → windows32/gluegen-rt.dll} +0 -0
  47. data/library/opengl/library/{jogl.dll → windows32/jogl.dll} +0 -0
  48. data/library/opengl/library/{jogl_awt.dll → windows32/jogl_awt.dll} +0 -0
  49. data/library/opengl/library/{jogl_cg.dll → windows32/jogl_cg.dll} +0 -0
  50. data/library/opengl/library/windows64/gluegen-rt.dll +0 -0
  51. data/library/opengl/library/windows64/jogl.dll +0 -0
  52. data/library/opengl/library/windows64/jogl_awt.dll +0 -0
  53. data/library/opengl/library/windows64/jogl_cg.dll +0 -0
  54. data/library/pdf/library/export.txt +1 -0
  55. data/library/pdf/library/itext.jar +0 -0
  56. data/library/pdf/library/pdf.jar +0 -0
  57. data/library/serial/library/RXTXcomm.jar +0 -0
  58. data/library/serial/library/export.txt +1 -3
  59. data/library/serial/library/linux32/librxtxSerial.so +0 -0
  60. data/library/serial/library/linux64/librxtxSerial.so +0 -0
  61. data/library/serial/library/macosx/librxtxSerial.jnilib +0 -0
  62. data/library/serial/library/serial.jar +0 -0
  63. data/library/serial/library/windows32/rxtxSerial.dll +0 -0
  64. data/library/serial/library/windows64/rxtxSerial.dll +0 -0
  65. data/library/video/library/export.txt +1 -0
  66. data/library/video/library/video.jar +0 -0
  67. data/samples/{animator.rb → contributed/animator.rb} +0 -0
  68. data/samples/{bezier_playground.rb → contributed/bezier_playground.rb} +0 -0
  69. data/samples/{circle_collision.rb → contributed/circle_collision.rb} +0 -0
  70. data/samples/contributed/drawolver.rb +182 -0
  71. data/samples/{empathy.rb → contributed/empathy.rb} +7 -7
  72. data/samples/{fern.rb → contributed/fern.rb} +0 -0
  73. data/samples/{flight_patterns.rb → contributed/flight_patterns.rb} +0 -0
  74. data/samples/{full_screen.rb → contributed/full_screen.rb} +0 -0
  75. data/samples/{getting_started.rb → contributed/getting_started.rb} +0 -0
  76. data/samples/{gravity.rb → contributed/gravity.rb} +0 -0
  77. data/samples/{jwishy.rb → contributed/jwishy.rb} +0 -0
  78. data/samples/{orbit.rb → contributed/orbit.rb} +0 -0
  79. data/samples/{pong.rb → contributed/pong.rb} +0 -0
  80. data/samples/{reflection.rb → contributed/reflection.rb} +0 -0
  81. data/samples/{simple_buffer.rb → contributed/simple_buffer.rb} +0 -0
  82. data/samples/{tree.rb → contributed/tree.rb} +0 -0
  83. data/samples/peasy_cam/library/hilbert/hilbert.rb +11 -10
  84. data/samples/processing_app/3D/camera/move_eye.rb +29 -0
  85. data/samples/processing_app/3D/form/brick_tower.rb +11 -11
  86. data/samples/processing_app/3D/form/cubic_grid.rb +51 -0
  87. data/samples/processing_app/3D/form/icosahedra/icosahedra.rb +76 -0
  88. data/samples/processing_app/3D/form/icosahedra/icosahedron.rb +116 -0
  89. data/samples/processing_app/3D/form/icosahedra/shape_3D.rb +25 -0
  90. data/samples/processing_app/3D/form/primitives.rb +42 -0
  91. data/samples/processing_app/3D/form/rgb_cube.rb +88 -0
  92. data/samples/processing_app/3D/form/shape_transform.rb +94 -0
  93. data/samples/processing_app/3D/form/toroid.rb +130 -0
  94. data/samples/processing_app/3D/form/vertices.rb +81 -0
  95. data/samples/processing_app/3D/image/data/eames.jpg +0 -0
  96. data/samples/processing_app/3D/image/data/ystone08.jpg +0 -0
  97. data/samples/processing_app/3D/image/explode.rb +56 -0
  98. data/samples/processing_app/3D/image/extrusion.rb +49 -0
  99. data/samples/processing_app/3D/image/zoom.rb +83 -0
  100. data/samples/processing_app/3D/lights/directional.rb +41 -0
  101. data/samples/processing_app/3D/lights/lights1.rb +39 -0
  102. data/samples/processing_app/3D/lights/lights2.rb +42 -0
  103. data/samples/processing_app/3D/lights/reflection.rb +38 -0
  104. data/samples/processing_app/3D/lights/spot.rb +39 -0
  105. data/samples/processing_app/3D/textures/data/berlin-1.jpg +0 -0
  106. data/samples/processing_app/3D/textures/texture1.rb +41 -0
  107. data/samples/processing_app/3D/textures/texture2.rb +38 -0
  108. data/samples/processing_app/3D/textures/texture3.rb +68 -0
  109. data/samples/processing_app/3D/textures/texture_cube.rb +106 -0
  110. data/samples/processing_app/3D/transform/bird.rb +61 -0
  111. data/samples/processing_app/3D/transform/birds/bird.rb +87 -0
  112. data/samples/processing_app/3D/transform/birds/birds.rb +48 -0
  113. data/samples/processing_app/3D/transform/cubes_in_cube/cube.rb +57 -0
  114. data/samples/processing_app/3D/transform/cubes_in_cube/cubes_in_cube.rb +102 -0
  115. data/samples/processing_app/3D/transform/push_pop_cubes.rb +152 -0
  116. data/samples/processing_app/3D/transform/rotate1.rb +43 -0
  117. data/samples/processing_app/3D/transform/rotate2.rb +45 -0
  118. data/samples/processing_app/3D/typography/data/Univers45.vlw +0 -0
  119. data/samples/processing_app/3D/typography/letter_k.rb +136 -0
  120. data/samples/processing_app/3D/typography/typing.rb +77 -0
  121. data/samples/processing_app/basics/form/triangle_strip.rb +19 -19
  122. data/samples/processing_app/basics/math/distance1.rb +59 -0
  123. data/samples/processing_app/basics/math/distance2.rb +38 -0
  124. data/samples/processing_app/basics/math/double_random.rb +38 -0
  125. data/samples/processing_app/basics/math/graphing_2_d_equation.rb +53 -0
  126. data/samples/processing_app/basics/math/increment_decrement.rb +59 -0
  127. data/samples/processing_app/basics/math/modulo.rb +43 -0
  128. data/samples/processing_app/basics/math/noise_1_d.rb +37 -0
  129. data/samples/processing_app/basics/math/noise_2_d.rb +47 -0
  130. data/samples/processing_app/basics/math/noise_3_d.rb +50 -0
  131. data/samples/processing_app/basics/math/noise_wave.rb +61 -0
  132. data/samples/processing_app/basics/math/operator_precedence.rb +70 -0
  133. data/samples/processing_app/basics/math/polar_to_cartesian.rb +44 -0
  134. data/samples/processing_app/basics/math/random.rb +35 -0
  135. data/samples/processing_app/basics/math/sine.rb +49 -0
  136. data/samples/processing_app/basics/math/sine_cosine.rb +60 -0
  137. data/samples/processing_app/basics/math/sine_wave.rb +62 -0
  138. data/samples/processing_app/basics/objects/composite_objects.rb +139 -0
  139. data/samples/processing_app/basics/objects/inheritance.rb +104 -0
  140. data/samples/processing_app/basics/objects/multiple_constructors.rb +66 -0
  141. data/samples/processing_app/basics/objects/objects.rb +72 -0
  142. data/samples/processing_app/basics/shape/data/bot1.svg +160 -0
  143. data/samples/processing_app/basics/shape/data/usa-wikipedia.svg +452 -0
  144. data/samples/processing_app/basics/shape/disable_style.rb +36 -0
  145. data/samples/processing_app/basics/shape/get_child.rb +43 -0
  146. data/samples/processing_app/basics/shape/load_display_shape.rb +33 -0
  147. data/samples/processing_app/basics/shape/scale_shape.rb +33 -0
  148. data/samples/processing_app/basics/structure/coordinates.rb +55 -0
  149. data/samples/processing_app/basics/structure/create_graphics.rb +39 -0
  150. data/samples/processing_app/basics/structure/functions.rb +41 -0
  151. data/samples/processing_app/basics/structure/loop.rb +39 -0
  152. data/samples/processing_app/basics/structure/noloop.rb +33 -0
  153. data/samples/processing_app/basics/structure/recursion1.rb +42 -0
  154. data/samples/processing_app/basics/structure/recursion2.rb +39 -0
  155. data/samples/processing_app/basics/structure/redraw.rb +36 -0
  156. data/samples/processing_app/basics/structure/setup_draw.rb +30 -0
  157. data/samples/processing_app/basics/structure/statements_comments.rb +32 -0
  158. data/samples/processing_app/basics/structure/width_height.rb +29 -0
  159. data/samples/processing_app/basics/transform/arm.rb +47 -0
  160. data/samples/processing_app/basics/transform/rotate.rb +43 -0
  161. data/samples/processing_app/basics/transform/scale.rb +45 -0
  162. data/samples/processing_app/basics/transform/translate.rb +41 -0
  163. data/samples/processing_app/basics/transform/triangle_flower.rb +69 -0
  164. data/samples/processing_app/basics/typography/data/CourierNew36.vlw +0 -0
  165. data/samples/processing_app/basics/typography/data/Ziggurat-HTF-Black-32.vlw +0 -0
  166. data/samples/processing_app/basics/typography/letters.rb +52 -0
  167. data/samples/processing_app/basics/typography/words.rb +37 -0
  168. data/samples/processing_app/basics/web/embedded_links.rb +58 -0
  169. data/samples/processing_app/basics/web/loading_images.rb +25 -0
  170. metadata +181 -86
  171. data/lib/patches/JRubyApplet.diff +0 -24
  172. data/lib/patches/PATCHES.txt +0 -3
  173. data/lib/patches/PApplet.diff +0 -27
  174. data/library/minim/license.txt +0 -339
  175. data/library/minim/version.txt +0 -1
  176. data/library/opengl/library/gluegen-rt-natives-linux-amd64.jar +0 -0
  177. data/library/opengl/library/gluegen-rt-natives-linux-i586.jar +0 -0
  178. data/library/opengl/library/gluegen-rt-natives-macosx-ppc.jar +0 -0
  179. data/library/opengl/library/gluegen-rt-natives-macosx-universal.jar +0 -0
  180. data/library/opengl/library/gluegen-rt-natives-windows-amd64.jar +0 -0
  181. data/library/opengl/library/gluegen-rt-natives-windows-i586.jar +0 -0
  182. data/library/opengl/library/gluegen-rt.jar.pack.gz +0 -0
  183. data/library/opengl/library/jogl-natives-linux-amd64.jar +0 -0
  184. data/library/opengl/library/jogl-natives-linux-i586.jar +0 -0
  185. data/library/opengl/library/jogl-natives-macosx-ppc.jar +0 -0
  186. data/library/opengl/library/jogl-natives-macosx-universal.jar +0 -0
  187. data/library/opengl/library/jogl-natives-windows-amd64.jar +0 -0
  188. data/library/opengl/library/jogl-natives-windows-i586.jar +0 -0
  189. data/library/opengl/library/jogl.jar.pack.gz +0 -0
  190. data/library/pdf/notes.txt +0 -8
  191. data/library/serial/library/librxtxSerial.jnilib +0 -0
  192. data/library/serial/library/librxtxSerial.so +0 -0
  193. data/library/serial/library/rxtxSerial.dll +0 -0
@@ -0,0 +1,152 @@
1
+ # PushPop Cubes
2
+ # by Ira Greenberg.
3
+ #
4
+ # Array of rotating cubes creates
5
+ # dynamic field patterns. Color
6
+ # controlled by light sources. Example
7
+ # of pushMatrix() and popMatrix().
8
+
9
+ class PushPopCubes < Processing::App
10
+
11
+ def setup
12
+
13
+ size 640, 360, P3D
14
+
15
+ @cols = 21
16
+ @rows = 21
17
+ @cube_count = @cols * @rows
18
+ @cubes = []
19
+ @rot_vals = []
20
+ @angls = []
21
+ @rotspd = 2.0
22
+
23
+ @col_span = width / (@cols-1)
24
+ @row_span = height/ (@rows-1)
25
+
26
+ no_stroke
27
+
28
+ (0...@cube_count).each { |i|
29
+
30
+ @cubes.push Cube.new( 12, 12, 6, 0, 0, 0 )
31
+
32
+ #3 different rotation options
33
+ # - 1st option: cubes each rotate uniformly
34
+ # - 2nd option: cubes each rotate randomly
35
+ # - 3rd option: cube columns rotate as waves
36
+ #To try the different rotations, leave one
37
+ #of the "@rotVals.push ..." lines uncommented below
38
+ #and the other 2 commented out.
39
+
40
+ #@rot_vals.push @rotspd
41
+ #@rot_vals.push random( -@rotspd * 2, @rotspd * 2 )
42
+ @rot_vals.push @rotspd += 0.01
43
+
44
+ @angls.push 0.0
45
+ }
46
+
47
+ end
48
+
49
+ def draw
50
+
51
+ background 0
52
+ fill 200
53
+
54
+ point_light 51, 102, 255, width/3, height/2, 100
55
+ point_light 200, 40, 60, width/1.5, height/2, -150
56
+
57
+ ambient_light 170, 170, 100
58
+
59
+ cube_counter = 0
60
+
61
+ (0...@cols).each { |i|
62
+ (0...@rows).each { |j|
63
+
64
+ push_matrix
65
+
66
+ translate i * @col_span, j * @row_span, -20
67
+
68
+ rotate_y radians( @angls[cube_counter] )
69
+ rotate_x radians( @angls[cube_counter] )
70
+
71
+ @cubes[cube_counter].draw_cube
72
+
73
+ pop_matrix
74
+
75
+ cube_counter += 1
76
+
77
+ }
78
+ }
79
+
80
+ (0...@cube_count).each { |i| @angls[i] += @rot_vals[i] }
81
+
82
+ end
83
+
84
+ # Simple Cube class, based on Quads
85
+ class Cube
86
+
87
+ # Properties
88
+ attr_accessor :w, :h, :d
89
+ attr_accessor :shiftX, :shiftY, :shiftZ
90
+
91
+ # Constructor
92
+ def initialize ( w, h, d, shiftX, shiftY, shiftZ )
93
+ @w = w;
94
+ @h = h;
95
+ @d = d;
96
+ @shiftX = shiftX;
97
+ @shiftY = shiftY;
98
+ @shiftZ = shiftZ;
99
+ end
100
+
101
+ #Main cube drawing method, which looks
102
+ #more confusing than it really is. It's
103
+ #just a bunch of rectangles drawn for
104
+ #each cube face
105
+ def draw_cube
106
+
107
+ # Front face
108
+ beginShape QUADS
109
+
110
+ vertex -@w/2 + @shiftX, -@h/2 + @shiftY, -@d/2 + @shiftZ
111
+ vertex @w + @shiftX, -@h/2 + @shiftY, -@d/2 + @shiftZ
112
+ vertex @w + @shiftX, @h + @shiftY, -@d/2 + @shiftZ
113
+ vertex -@w/2 + @shiftX, @h + @shiftY, -@d/2 + @shiftZ
114
+
115
+ # Back face
116
+ vertex -@w/2 + @shiftX, -@h/2 + @shiftY, @d + @shiftZ
117
+ vertex @w + @shiftX, -@h/2 + @shiftY, @d + @shiftZ
118
+ vertex @w + @shiftX, @h + @shiftY, @d + @shiftZ
119
+ vertex -@w/2 + @shiftX, @h + @shiftY, @d + @shiftZ
120
+
121
+ # Left face
122
+ vertex -@w/2 + @shiftX, -@h/2 + @shiftY, -@d/2 + @shiftZ
123
+ vertex -@w/2 + @shiftX, -@h/2 + @shiftY, @d + @shiftZ
124
+ vertex -@w/2 + @shiftX, @h + @shiftY, @d + @shiftZ
125
+ vertex -@w/2 + @shiftX, @h + @shiftY, -@d/2 + @shiftZ
126
+
127
+ # Right face
128
+ vertex @w + @shiftX, -@h/2 + @shiftY, -@d/2 + @shiftZ
129
+ vertex @w + @shiftX, -@h/2 + @shiftY, @d + @shiftZ
130
+ vertex @w + @shiftX, @h + @shiftY, @d + @shiftZ
131
+ vertex @w + @shiftX, @h + @shiftY, -@d/2 + @shiftZ
132
+
133
+ # Top face
134
+ vertex -@w/2 + @shiftX, -@h/2 + @shiftY, -@d/2 + @shiftZ
135
+ vertex @w + @shiftX, -@h/2 + @shiftY, -@d/2 + @shiftZ
136
+ vertex @w + @shiftX, -@h/2 + @shiftY, @d + @shiftZ
137
+ vertex -@w/2 + @shiftX, -@h/2 + @shiftY, @d + @shiftZ
138
+
139
+ # Bottom face
140
+ vertex -@w/2 + @shiftX, @h + @shiftY, -@d/2 + @shiftZ
141
+ vertex @w + @shiftX, @h + @shiftY, -@d/2 + @shiftZ
142
+ vertex @w + @shiftX, @h + @shiftY, @d + @shiftZ
143
+ vertex -@w/2 + @shiftX, @h + @shiftY, @d + @shiftZ
144
+
145
+ end_shape
146
+ end
147
+
148
+ end #class Cube
149
+
150
+ end
151
+
152
+ PushPopCubes.new :title => "Push Pop Cubes"
@@ -0,0 +1,43 @@
1
+ # Rotate 1.
2
+ #
3
+ # Rotating simultaneously in the X and Y axis.
4
+ # Transformation functions such as rotate() are additive.
5
+ # Successively calling rotate(1.0) and rotate(2.0)
6
+ # is equivalent to calling rotate(3.0).
7
+
8
+ class Rotate1 < Processing::App
9
+
10
+ def setup
11
+
12
+ size 640, 360, P3D
13
+
14
+ @r_size = width / 6.0
15
+ @a = 0.0
16
+
17
+ no_stroke
18
+ fill 204, 204
19
+
20
+ end
21
+
22
+ def draw
23
+
24
+ background 0
25
+
26
+ @a += 0.005
27
+ @a = 0.0 if @a > TWO_PI
28
+
29
+ translate width/2, height/2
30
+
31
+ rotate_x @a
32
+ rotate_y @a * 2
33
+ rect -@r_size, -@r_size, @r_size*2, @r_size*2
34
+
35
+ rotate_x @a * 1.001
36
+ rotate_y @a * 2.002
37
+ rect -@r_size, -@r_size, @r_size*2, @r_size*2
38
+
39
+ end
40
+
41
+ end
42
+
43
+ Rotate1.new :title => "Rotate1"
@@ -0,0 +1,45 @@
1
+ # Rotate2
2
+
3
+ class Rotate2 < Processing::App
4
+
5
+ def setup
6
+
7
+ size 640, 360, P3D
8
+
9
+ @num = 12
10
+ @colors = []
11
+ @a = 0.0
12
+ @offset = PI/24
13
+
14
+ no_stroke
15
+ lights
16
+
17
+ 1.upto(@num) { |i|
18
+ @colors.push color 255 * i / @num
19
+ }
20
+
21
+ end
22
+
23
+ def draw
24
+
25
+ background 0, 0, 26
26
+
27
+ translate width/2, height/2
28
+
29
+ @a += 0.01
30
+
31
+ @colors.each_with_index { |c, i|
32
+ push_matrix
33
+ fill c
34
+ rotate_y @a + @offset * i
35
+ rotate_x @a/2 + @offset * i
36
+
37
+ box 200
38
+ pop_matrix
39
+ }
40
+
41
+ end
42
+
43
+ end
44
+
45
+ Rotate2.new :title => "Rotate2"
@@ -0,0 +1,136 @@
1
+ # Letter K
2
+ # by Peter Cho.
3
+ #
4
+ # Move the mouse across the screen to fold the "K".
5
+
6
+ class LetterK < Processing::App
7
+
8
+ def setup
9
+
10
+ size 640, 360, P3D
11
+
12
+ no_stroke
13
+
14
+ @back_color = color 134, 144, 154
15
+ @fore_color = color 235, 235, 30
16
+ @fore_color2 = color 240, 130, 20
17
+
18
+ init_particle 0.6, 0.9, width/2, height/2
19
+
20
+ end
21
+
22
+ def draw
23
+
24
+ background @back_color
25
+
26
+ push_matrix
27
+
28
+ iterate_particle 0.15 * (-@px + mouse_x), 0.15 * (-@py + (height-mouse_y))
29
+
30
+ translate width/2, height/2
31
+
32
+ fill @fore_color
33
+
34
+ draw_k
35
+
36
+ push_matrix
37
+
38
+ translate 0, 0, 1
39
+ translate 0.75 * (@px-width/2), -0.75 * (@py-height/2), 0
40
+ translate 0.75 * (@px-width/2), -0.75 * (@py-height/2), 0
41
+ rotate_z atan2( -(@py-height/2), (@px-width/2) ) + PI/2
42
+ rotate_x PI
43
+ rotate_z -(atan2( -(@py-height/2), (@px-width/2) ) + PI/2)
44
+
45
+ fill @fore_color2
46
+ draw_k
47
+
48
+ pop_matrix
49
+
50
+ translate 0.75 * (@px-width/2), -0.75 * (@py-height/2), 2
51
+ rotate_z atan2( -(@py-height/2), (@px-width/2) ) + PI/2
52
+
53
+ fill @back_color
54
+
55
+ begin_shape QUADS
56
+
57
+ vertex -640, 0
58
+ vertex 640, 0
59
+ vertex 640, -360
60
+ vertex -640, -360
61
+
62
+ end_shape
63
+
64
+ pop_matrix
65
+
66
+ end
67
+
68
+ def init_particle ( mass, drag, ox, oy )
69
+
70
+ @px = ox
71
+ @py = oy
72
+ @pv2 = 0.0
73
+ @pvx = 0.0
74
+ @pvy = 0.0
75
+ @pa2 = 0.0
76
+ @pax = 0.0
77
+ @pay = 0.0
78
+ @p_mass = mass
79
+ @p_drag = drag
80
+
81
+ end
82
+
83
+ def iterate_particle ( fkx, fky )
84
+
85
+ @pfx = fkx
86
+ @pfy = fky
87
+ @pa2 = @pfx * @pfx + @pfy * @pfy
88
+ return if @pa2 < 0.1e-6
89
+
90
+ @pax = @pfx / @p_mass
91
+ @pay = @pfy / @p_mass
92
+ @pvx += @pax
93
+ @pvy += @pay
94
+ @pv2 = @pvx * @pvx + @pvy * @pvy
95
+ return if @pv2 < 0.1e-6
96
+
97
+ @pvx *= 1.0 - @p_drag
98
+ @pvy *= 1.0 - @p_drag
99
+ @px += @pvx
100
+ @py += @pvy
101
+
102
+ end
103
+
104
+ def draw_k
105
+
106
+ push_matrix
107
+
108
+ scale 1.5
109
+ translate -63, 71
110
+
111
+ begin_shape QUADS
112
+
113
+ vertex 0, 0, 0
114
+ vertex 0, -142.7979, 0
115
+ vertex 37.1992, -142.7979, 0
116
+ vertex 37.1992, 0, 0
117
+
118
+ vertex 37.1992, -87.9990, 0
119
+ vertex 84.1987, -142.7979, 0
120
+ vertex 130.3979, -142.7979, 0
121
+ vertex 37.1992, -43.999, 0
122
+
123
+ vertex 77.5986-0.2, -86.5986-0.3, 0
124
+ vertex 136.998, 0, 0
125
+ vertex 90.7988, 0, 0
126
+ vertex 52.3994-0.2, -59.999-0.3, 0
127
+
128
+ end_shape
129
+
130
+ pop_matrix
131
+
132
+ end
133
+
134
+ end
135
+
136
+ LetterK.new :title => "Letter K"
@@ -0,0 +1,77 @@
1
+ # Typing (Excerpt from the piece Textension)
2
+ # by Josh Nimoy.
3
+ #
4
+ # Click in the window to give it focus.
5
+ # Type to add letters and press backspace or delete to remove them.
6
+
7
+ class Typing < Processing::App
8
+
9
+ def setup
10
+
11
+ size 640, 360, P3D
12
+
13
+ @left_margin = 10
14
+ @right_margin = 20
15
+ @buf = ""
16
+
17
+ text_font load_font( "Univers45.vlw" ), 25
18
+
19
+ end
20
+
21
+ def draw
22
+
23
+ background 176
24
+
25
+ if (millis % 500) < 200
26
+ no_fill
27
+ else
28
+ fill 255
29
+ stroke 0
30
+ end
31
+
32
+ r_pos = text_width( @buf ) + @left_margin
33
+ rect r_pos+1, 19, 10, 21
34
+
35
+ fill 0
36
+
37
+ push_matrix
38
+
39
+ translate r_pos, 35
40
+
41
+ if @buf.length > 0
42
+ (0...@buf.length).each { |i|
43
+ k = @buf[@buf.length - 1 - i]
44
+ translate -text_width( k ), 0
45
+ rotate_y -text_width( k ) / 70.0
46
+ rotate_x text_width( k ) / 70.0
47
+ scale 1.1
48
+ text k, 0, 0
49
+ }
50
+ end
51
+
52
+ pop_matrix
53
+
54
+ end
55
+
56
+ def key_pressed
57
+
58
+ if key != CODED &&
59
+ text_width( @buf + key ) + @left_margin < width - @right_margin &&
60
+ keyCode != BACKSPACE &&
61
+ keyCode != DELETE
62
+ @buf += key
63
+ end
64
+
65
+ if keyCode == BACKSPACE || keyCode == DELETE
66
+ if @buf.length > 1
67
+ @buf = @buf[0..(@buf.length-2)]
68
+ else
69
+ @buf = ""
70
+ end
71
+ end
72
+
73
+ end
74
+
75
+ end
76
+
77
+ Typing.new :title => "Typing"