ruby-processing 1.0.9 → 1.0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +13 -1
- data/bin/rp5 +8 -2
- data/lib/core/core.jar +0 -0
- data/lib/core/jruby-complete.jar +0 -0
- data/lib/ruby-processing.rb +2 -2
- data/lib/ruby-processing/app.rb +108 -338
- data/lib/ruby-processing/config.rb +6 -0
- data/lib/ruby-processing/helper_methods.rb +120 -0
- data/lib/ruby-processing/library_loader.rb +140 -0
- data/lib/ruby-processing/runner.rb +34 -4
- data/lib/ruby-processing/runners/base.rb +10 -11
- data/lib/ruby-processing/runners/live.rb +1 -1
- data/lib/ruby-processing/runners/run.rb +1 -1
- data/lib/ruby-processing/runners/watch.rb +18 -76
- data/lib/templates/applet/index.html.erb +8 -9
- data/library/control_panel/control_panel.rb +1 -1
- data/library/dxf/library/dxf.jar +0 -0
- data/library/dxf/library/export.txt +1 -0
- data/library/javascript/library/export.txt +3 -1
- data/library/minim/library/export.txt +1 -0
- 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 +1 -0
- data/library/net/library/net.jar +0 -0
- data/library/opengl/library/export.txt +7 -10
- data/library/opengl/library/gluegen-rt.jar +0 -0
- data/library/opengl/library/jogl.jar +0 -0
- data/library/opengl/library/{libgluegen-rt.so → linux32/libgluegen-rt.so} +0 -0
- data/library/opengl/library/{libjogl.so → linux32/libjogl.so} +0 -0
- data/library/opengl/library/{libjogl_awt.so → linux32/libjogl_awt.so} +0 -0
- data/library/opengl/library/{libjogl_cg.so → 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/{libgluegen-rt.jnilib → macosx/libgluegen-rt.jnilib} +0 -0
- data/library/opengl/library/{libjogl.jnilib → macosx/libjogl.jnilib} +0 -0
- data/library/opengl/library/{libjogl_awt.jnilib → macosx/libjogl_awt.jnilib} +0 -0
- data/library/opengl/library/{libjogl_cg.jnilib → macosx/libjogl_cg.jnilib} +0 -0
- data/library/opengl/library/opengl.jar +0 -0
- data/library/opengl/library/{gluegen-rt.dll → windows32/gluegen-rt.dll} +0 -0
- data/library/opengl/library/{jogl.dll → windows32/jogl.dll} +0 -0
- data/library/opengl/library/{jogl_awt.dll → windows32/jogl_awt.dll} +0 -0
- data/library/opengl/library/{jogl_cg.dll → 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 +1 -0
- 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 +1 -3
- 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 +1 -0
- data/library/video/library/video.jar +0 -0
- data/samples/{animator.rb → contributed/animator.rb} +0 -0
- data/samples/{bezier_playground.rb → contributed/bezier_playground.rb} +0 -0
- data/samples/{circle_collision.rb → contributed/circle_collision.rb} +0 -0
- data/samples/contributed/drawolver.rb +182 -0
- data/samples/{empathy.rb → contributed/empathy.rb} +7 -7
- data/samples/{fern.rb → contributed/fern.rb} +0 -0
- data/samples/{flight_patterns.rb → contributed/flight_patterns.rb} +0 -0
- data/samples/{full_screen.rb → contributed/full_screen.rb} +0 -0
- data/samples/{getting_started.rb → contributed/getting_started.rb} +0 -0
- data/samples/{gravity.rb → contributed/gravity.rb} +0 -0
- data/samples/{jwishy.rb → contributed/jwishy.rb} +0 -0
- data/samples/{orbit.rb → contributed/orbit.rb} +0 -0
- data/samples/{pong.rb → contributed/pong.rb} +0 -0
- data/samples/{reflection.rb → contributed/reflection.rb} +0 -0
- data/samples/{simple_buffer.rb → contributed/simple_buffer.rb} +0 -0
- data/samples/{tree.rb → contributed/tree.rb} +0 -0
- data/samples/peasy_cam/library/hilbert/hilbert.rb +11 -10
- data/samples/processing_app/3D/camera/move_eye.rb +29 -0
- data/samples/processing_app/3D/form/brick_tower.rb +11 -11
- data/samples/processing_app/3D/form/cubic_grid.rb +51 -0
- data/samples/processing_app/3D/form/icosahedra/icosahedra.rb +76 -0
- data/samples/processing_app/3D/form/icosahedra/icosahedron.rb +116 -0
- data/samples/processing_app/3D/form/icosahedra/shape_3D.rb +25 -0
- data/samples/processing_app/3D/form/primitives.rb +42 -0
- data/samples/processing_app/3D/form/rgb_cube.rb +88 -0
- data/samples/processing_app/3D/form/shape_transform.rb +94 -0
- data/samples/processing_app/3D/form/toroid.rb +130 -0
- data/samples/processing_app/3D/form/vertices.rb +81 -0
- data/samples/processing_app/3D/image/data/eames.jpg +0 -0
- data/samples/processing_app/3D/image/data/ystone08.jpg +0 -0
- data/samples/processing_app/3D/image/explode.rb +56 -0
- data/samples/processing_app/3D/image/extrusion.rb +49 -0
- data/samples/processing_app/3D/image/zoom.rb +83 -0
- data/samples/processing_app/3D/lights/directional.rb +41 -0
- data/samples/processing_app/3D/lights/lights1.rb +39 -0
- data/samples/processing_app/3D/lights/lights2.rb +42 -0
- data/samples/processing_app/3D/lights/reflection.rb +38 -0
- data/samples/processing_app/3D/lights/spot.rb +39 -0
- data/samples/processing_app/3D/textures/data/berlin-1.jpg +0 -0
- data/samples/processing_app/3D/textures/texture1.rb +41 -0
- data/samples/processing_app/3D/textures/texture2.rb +38 -0
- data/samples/processing_app/3D/textures/texture3.rb +68 -0
- data/samples/processing_app/3D/textures/texture_cube.rb +106 -0
- data/samples/processing_app/3D/transform/bird.rb +61 -0
- data/samples/processing_app/3D/transform/birds/bird.rb +87 -0
- data/samples/processing_app/3D/transform/birds/birds.rb +48 -0
- data/samples/processing_app/3D/transform/cubes_in_cube/cube.rb +57 -0
- data/samples/processing_app/3D/transform/cubes_in_cube/cubes_in_cube.rb +102 -0
- data/samples/processing_app/3D/transform/push_pop_cubes.rb +152 -0
- data/samples/processing_app/3D/transform/rotate1.rb +43 -0
- data/samples/processing_app/3D/transform/rotate2.rb +45 -0
- data/samples/processing_app/3D/typography/data/Univers45.vlw +0 -0
- data/samples/processing_app/3D/typography/letter_k.rb +136 -0
- data/samples/processing_app/3D/typography/typing.rb +77 -0
- data/samples/processing_app/basics/form/triangle_strip.rb +19 -19
- data/samples/processing_app/basics/math/distance1.rb +59 -0
- data/samples/processing_app/basics/math/distance2.rb +38 -0
- data/samples/processing_app/basics/math/double_random.rb +38 -0
- data/samples/processing_app/basics/math/graphing_2_d_equation.rb +53 -0
- data/samples/processing_app/basics/math/increment_decrement.rb +59 -0
- data/samples/processing_app/basics/math/modulo.rb +43 -0
- data/samples/processing_app/basics/math/noise_1_d.rb +37 -0
- data/samples/processing_app/basics/math/noise_2_d.rb +47 -0
- data/samples/processing_app/basics/math/noise_3_d.rb +50 -0
- data/samples/processing_app/basics/math/noise_wave.rb +61 -0
- data/samples/processing_app/basics/math/operator_precedence.rb +70 -0
- data/samples/processing_app/basics/math/polar_to_cartesian.rb +44 -0
- data/samples/processing_app/basics/math/random.rb +35 -0
- data/samples/processing_app/basics/math/sine.rb +49 -0
- data/samples/processing_app/basics/math/sine_cosine.rb +60 -0
- data/samples/processing_app/basics/math/sine_wave.rb +62 -0
- data/samples/processing_app/basics/objects/composite_objects.rb +139 -0
- data/samples/processing_app/basics/objects/inheritance.rb +104 -0
- data/samples/processing_app/basics/objects/multiple_constructors.rb +66 -0
- data/samples/processing_app/basics/objects/objects.rb +72 -0
- data/samples/processing_app/basics/shape/data/bot1.svg +160 -0
- data/samples/processing_app/basics/shape/data/usa-wikipedia.svg +452 -0
- data/samples/processing_app/basics/shape/disable_style.rb +36 -0
- data/samples/processing_app/basics/shape/get_child.rb +43 -0
- data/samples/processing_app/basics/shape/load_display_shape.rb +33 -0
- data/samples/processing_app/basics/shape/scale_shape.rb +33 -0
- data/samples/processing_app/basics/structure/coordinates.rb +55 -0
- data/samples/processing_app/basics/structure/create_graphics.rb +39 -0
- data/samples/processing_app/basics/structure/functions.rb +41 -0
- data/samples/processing_app/basics/structure/loop.rb +39 -0
- data/samples/processing_app/basics/structure/noloop.rb +33 -0
- data/samples/processing_app/basics/structure/recursion1.rb +42 -0
- data/samples/processing_app/basics/structure/recursion2.rb +39 -0
- data/samples/processing_app/basics/structure/redraw.rb +36 -0
- data/samples/processing_app/basics/structure/setup_draw.rb +30 -0
- data/samples/processing_app/basics/structure/statements_comments.rb +32 -0
- data/samples/processing_app/basics/structure/width_height.rb +29 -0
- data/samples/processing_app/basics/transform/arm.rb +47 -0
- data/samples/processing_app/basics/transform/rotate.rb +43 -0
- data/samples/processing_app/basics/transform/scale.rb +45 -0
- data/samples/processing_app/basics/transform/translate.rb +41 -0
- data/samples/processing_app/basics/transform/triangle_flower.rb +69 -0
- data/samples/processing_app/basics/typography/data/CourierNew36.vlw +0 -0
- data/samples/processing_app/basics/typography/data/Ziggurat-HTF-Black-32.vlw +0 -0
- data/samples/processing_app/basics/typography/letters.rb +52 -0
- data/samples/processing_app/basics/typography/words.rb +37 -0
- data/samples/processing_app/basics/web/embedded_links.rb +58 -0
- data/samples/processing_app/basics/web/loading_images.rb +25 -0
- metadata +181 -86
- data/lib/patches/JRubyApplet.diff +0 -24
- data/lib/patches/PATCHES.txt +0 -3
- data/lib/patches/PApplet.diff +0 -27
- data/library/minim/license.txt +0 -339
- data/library/minim/version.txt +0 -1
- data/library/opengl/library/gluegen-rt-natives-linux-amd64.jar +0 -0
- data/library/opengl/library/gluegen-rt-natives-linux-i586.jar +0 -0
- data/library/opengl/library/gluegen-rt-natives-macosx-ppc.jar +0 -0
- data/library/opengl/library/gluegen-rt-natives-macosx-universal.jar +0 -0
- data/library/opengl/library/gluegen-rt-natives-windows-amd64.jar +0 -0
- data/library/opengl/library/gluegen-rt-natives-windows-i586.jar +0 -0
- data/library/opengl/library/gluegen-rt.jar.pack.gz +0 -0
- data/library/opengl/library/jogl-natives-linux-amd64.jar +0 -0
- data/library/opengl/library/jogl-natives-linux-i586.jar +0 -0
- data/library/opengl/library/jogl-natives-macosx-ppc.jar +0 -0
- data/library/opengl/library/jogl-natives-macosx-universal.jar +0 -0
- data/library/opengl/library/jogl-natives-windows-amd64.jar +0 -0
- data/library/opengl/library/jogl-natives-windows-i586.jar +0 -0
- data/library/opengl/library/jogl.jar.pack.gz +0 -0
- data/library/pdf/notes.txt +0 -8
- data/library/serial/library/librxtxSerial.jnilib +0 -0
- data/library/serial/library/librxtxSerial.so +0 -0
- 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"
|
Binary file
|
@@ -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"
|