ruby-processing 2.6.2 → 2.6.3
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.
- checksums.yaml +4 -4
- data/lib/rpextras.jar +0 -0
- data/lib/ruby-processing.rb +5 -8
- data/lib/ruby-processing/app.rb +26 -27
- data/lib/ruby-processing/config.rb +0 -2
- data/lib/ruby-processing/exporters/application_exporter.rb +1 -1
- data/lib/ruby-processing/exporters/base_exporter.rb +1 -1
- data/lib/ruby-processing/exporters/creator.rb +11 -11
- data/lib/ruby-processing/helper_methods.rb +33 -31
- data/lib/ruby-processing/helpers/numeric.rb +1 -1
- data/lib/ruby-processing/helpers/range.rb +11 -0
- data/lib/ruby-processing/library_loader.rb +11 -16
- data/lib/ruby-processing/runner.rb +22 -24
- data/lib/ruby-processing/runners/watch.rb +1 -1
- data/lib/ruby-processing/version.rb +1 -1
- data/library/boids/boids.rb +39 -70
- data/library/control_panel/control_panel.rb +3 -3
- data/samples/contributed/circle_collision.rb +3 -3
- data/samples/contributed/fern.rb +7 -10
- data/samples/contributed/fibonacci_sphere.rb +2 -2
- data/samples/contributed/full_screen.rb +23 -22
- data/samples/contributed/grapher.rb +3 -3
- data/samples/contributed/gravity.rb +1 -1
- data/samples/contributed/mandelbrot.rb +10 -13
- data/samples/external_library/java_processing/box2d_processing/bumpy_surface_noise.rb +1 -1
- data/samples/external_library/java_processing/box2d_processing/library/custom_shape/custom_shape.rb +2 -2
- data/samples/external_library/java_processing/box2d_processing/library/particle_system/particle_system.rb +1 -1
- data/samples/external_library/java_processing/box2d_processing/library/surface/surface.rb +2 -2
- data/samples/external_library/java_processing/box2d_processing/liquidy.rb +1 -1
- data/samples/external_library/java_processing/fisica/bubbles.rb +2 -2
- data/samples/external_library/java_processing/fisica/joints.rb +4 -4
- data/samples/external_library/java_processing/generative_design/node_spring_attractor.rb +2 -2
- data/samples/external_library/java_processing/geomerative/hello_world_rotate_firstletter.rb +7 -7
- data/samples/external_library/java_processing/hemesh/twin_iso.rb +3 -3
- data/samples/external_library/java_processing/pbox2d/bumpy_surface_noise.rb +1 -1
- data/samples/external_library/java_processing/pbox2d/library/custom_shape/custom_shape.rb +2 -2
- data/samples/external_library/java_processing/pbox2d/library/particle_system/particle_system.rb +1 -1
- data/samples/external_library/java_processing/pbox2d/library/surface/surface.rb +2 -2
- data/samples/external_library/java_processing/pbox2d/liquidy.rb +1 -1
- data/samples/external_library/java_processing/peasy_cam/library/hilbert/hilbert.rb +4 -4
- data/samples/external_library/ruby_gem/draw_test.rb +2 -2
- data/samples/external_library/ruby_gem/game_of_life.rb +3 -3
- data/samples/processing_app/basics/arrays/array_objects.rb +2 -2
- data/samples/processing_app/basics/color/hue.rb +1 -1
- data/samples/processing_app/basics/control/conditionals1.rb +5 -24
- data/samples/processing_app/basics/control/conditionals2.rb +1 -1
- data/samples/processing_app/basics/form/bezier_ellipse.rb +1 -1
- data/samples/processing_app/basics/form/brick_tower.rb +4 -8
- data/samples/processing_app/basics/form/regular_polygon.rb +1 -1
- data/samples/processing_app/basics/form/star.rb +1 -1
- data/samples/processing_app/basics/form/triangle_strip.rb +1 -1
- data/samples/processing_app/basics/input/storing_input.rb +1 -1
- data/samples/processing_app/basics/lights/spot.rb +1 -1
- data/samples/processing_app/basics/math/additive_wave.rb +2 -2
- data/samples/processing_app/basics/math/double_random.rb +2 -2
- data/samples/processing_app/basics/math/noise_wave.rb +1 -1
- data/samples/processing_app/basics/math/random.rb +1 -1
- data/samples/processing_app/basics/objects/module.rb +1 -1
- data/samples/processing_app/basics/objects/struct.rb +1 -1
- data/samples/processing_app/basics/structure/loop.rb +19 -14
- data/samples/processing_app/basics/structure/recursion2.rb +2 -2
- data/samples/processing_app/basics/textures/texture3.rb +13 -33
- data/samples/processing_app/basics/transform/birds.rb +5 -5
- data/samples/processing_app/basics/transform/cubes_in_cube.rb +3 -3
- data/samples/processing_app/basics/transform/rotate.rb +1 -1
- data/samples/processing_app/basics/typography/kinetic_type.rb +1 -1
- data/samples/processing_app/demos/graphics/bezier_patch.rb +34 -34
- data/samples/processing_app/demos/graphics/trefoil.rb +1 -1
- data/samples/processing_app/demos/graphics/wiggling.rb +5 -5
- data/samples/processing_app/demos/performance/esfera.rb +4 -4
- data/samples/processing_app/demos/performance/text_rendering.rb +1 -1
- data/samples/processing_app/library/dxf/simple_export.rb +3 -3
- data/samples/processing_app/library/pdf/complex_3D.rb +11 -11
- data/samples/processing_app/library/vecmath/vec2d/bouncing_ball.rb +1 -1
- data/samples/processing_app/library/vecmath/vec2d/circle_collision.rb +3 -3
- data/samples/processing_app/library/vecmath/vec2d/library/flock/flock.rb +5 -5
- data/samples/processing_app/library/vecmath/vec2d/library/particle/{particle_system.rb → particle.rb} +28 -21
- data/samples/processing_app/library/vecmath/vec2d/morph.rb +3 -3
- data/samples/processing_app/library/vecmath/vec2d/particle_system_pshape.rb +3 -3
- data/samples/processing_app/library/vecmath/vec2d/reflection1.rb +2 -2
- data/samples/processing_app/library/vecmath/vec2d/seeking_neural.rb +3 -2
- data/samples/processing_app/library/vecmath/vec2d/simple_particle_system.rb +1 -1
- data/samples/processing_app/library/vecmath/vec3d/frame_of_reference.rb +4 -4
- data/samples/processing_app/topics/advanced_data/library/word/word.rb +1 -1
- data/samples/processing_app/topics/advanced_data/load_save_XML.rb +1 -1
- data/samples/processing_app/topics/advanced_data/load_save_json.rb +1 -1
- data/samples/processing_app/topics/advanced_data/load_save_struct_yaml.rb +1 -1
- data/samples/processing_app/topics/advanced_data/load_save_yaml.rb +1 -1
- data/samples/processing_app/topics/advanced_data/threads_two.rb +1 -2
- data/samples/processing_app/topics/cellular_automata/game_of_life.rb +3 -3
- data/samples/processing_app/topics/cellular_automata/library/ca/ca.rb +2 -2
- data/samples/processing_app/topics/cellular_automata/library/cell/cell.rb +4 -4
- data/samples/processing_app/topics/cellular_automata/library/simple_cell/simple_cell.rb +1 -1
- data/samples/processing_app/topics/cellular_automata/spore1.rb +1 -1
- data/samples/processing_app/topics/cellular_automata/spore2.rb +1 -1
- data/samples/processing_app/topics/create_shapes/group_pshape.rb +2 -2
- data/samples/processing_app/topics/create_shapes/library/particle/particle_system.rb +3 -3
- data/samples/processing_app/topics/create_shapes/library/polygon/polygon.rb +2 -2
- data/samples/processing_app/topics/create_shapes/library/star/star.rb +3 -3
- data/samples/processing_app/topics/create_shapes/particle_system_pshape.rb +1 -1
- data/samples/processing_app/topics/create_shapes/path_pshape.rb +1 -1
- data/samples/processing_app/topics/drawing/scribble_plotter.rb +2 -2
- data/samples/processing_app/topics/gui/button.rb +16 -16
- data/samples/processing_app/topics/gui/rollover.rb +13 -13
- data/samples/processing_app/topics/image_processing/blur.rb +2 -2
- data/samples/processing_app/topics/image_processing/edge_detection.rb +2 -2
- data/samples/processing_app/topics/lsystems/cstest.rb +1 -1
- data/samples/processing_app/topics/lsystems/library/stochastic_grammar/stochastic_grammar.rb +1 -1
- data/samples/processing_app/topics/motion/bouncy_bubbles.rb +1 -1
- data/samples/processing_app/topics/motion/brownian.rb +2 -2
- data/samples/processing_app/topics/motion/circle_collision.rb +1 -1
- data/samples/processing_app/topics/motion/cubes_in_cube.rb +1 -1
- data/samples/processing_app/topics/motion/library/cube/cube.rb +2 -2
- data/samples/processing_app/topics/motion/morph.rb +11 -11
- data/samples/processing_app/topics/motion/moving_on_curves.rb +4 -4
- data/samples/processing_app/topics/motion/puff.rb +4 -4
- data/samples/processing_app/topics/motion/reflection1.rb +3 -3
- data/samples/processing_app/topics/motion/reflection2.rb +1 -1
- data/samples/processing_app/topics/shaders/bw_shader.rb +1 -1
- data/samples/processing_app/topics/shaders/glsl_heightmap_noise.rb +2 -2
- data/samples/processing_app/topics/simulate/flocking.rb +6 -6
- data/samples/processing_app/topics/simulate/library/flock/flock.rb +33 -41
- data/samples/processing_app/topics/simulate/multiple_particle_systems.rb +34 -60
- data/samples/processing_app/topics/simulate/simple_particle_system.rb +20 -32
- data/samples/processing_app/topics/simulate/smoke_particle_system.rb +45 -57
- data/samples/processing_app/topics/simulate/springs.rb +40 -44
- metadata +4 -5
- data/samples/processing_app/library/vecmath/vec2d/multiple_particle_systems.rb +0 -141
- data/samples/processing_app/library/vecmath/vec2d/smoke_particle_system.rb +0 -133
@@ -108,13 +108,13 @@ def train
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def result_label(result)
|
111
|
-
if result.
|
111
|
+
if result.reduce(0, :+).between?(1.9, 2.1)
|
112
112
|
if result[0] < 0.01 && result[1].between?(0.99, 1.0) && result[2].between?(0.99, 1.0)
|
113
113
|
return "CIRCLE"
|
114
114
|
else
|
115
115
|
return "UNKNOWN"
|
116
116
|
end
|
117
|
-
elsif result.
|
117
|
+
elsif result.reduce(0, :+).between?(0.95, 1.1)
|
118
118
|
if result[0].between?(0.95, 1.0) && (result[1] + result[2]) < 0.01
|
119
119
|
return "TRIANGLE"
|
120
120
|
elsif result[1].between?(0.95, 1.0) && (result[0] + result[2]) < 0.01
|
@@ -87,8 +87,8 @@ def tick! # When the clock ticks
|
|
87
87
|
(0 ... column).each do |y|
|
88
88
|
# And visit all the neighbours of each cell
|
89
89
|
neighbours = 0 # We'll count the neighbours
|
90
|
-
(x - 1
|
91
|
-
(y - 1
|
90
|
+
(x - 1..x + 1).each do |xx|
|
91
|
+
(y - 1..y + 1).each do |yy|
|
92
92
|
# Make sure you are not out of bounds
|
93
93
|
if [(xx>=0), (xx<row), (yy>=0), (yy<column)].all? {|in_bounds| in_bounds == true}
|
94
94
|
# Make sure to check against self
|
@@ -101,7 +101,7 @@ def tick! # When the clock ticks
|
|
101
101
|
end # End of yy loop
|
102
102
|
end #End of xx loop
|
103
103
|
# We've checked the neighbours: apply rules in one line (only in ruby)!
|
104
|
-
cells.set([x, y], (cells_buffer.get([x, y]))? ((2
|
104
|
+
cells.set([x, y], (cells_buffer.get([x, y]))? ((2..3) === neighbours) : (neighbours == 3))
|
105
105
|
end # End of y loop
|
106
106
|
end # End of x loop
|
107
107
|
end # End of function
|
@@ -12,7 +12,7 @@ def setup
|
|
12
12
|
@mods = []
|
13
13
|
wide_count.times do |i|
|
14
14
|
height_count.times do |j|
|
15
|
-
mods << CustomObject.new(j * UNIT, i * UNIT, UNIT/2, UNIT/2, rand(0.05
|
15
|
+
mods << CustomObject.new(j * UNIT, i * UNIT, UNIT/2, UNIT/2, rand(0.05..0.8))
|
16
16
|
end
|
17
17
|
end
|
18
18
|
no_stroke
|
@@ -41,7 +41,7 @@ class CustomObject
|
|
41
41
|
|
42
42
|
def update
|
43
43
|
@x += @speed * @xdir
|
44
|
-
unless (0
|
44
|
+
unless (0..size).cover? x
|
45
45
|
@xdir *= -1
|
46
46
|
@x += @xdir
|
47
47
|
@y += @ydir
|
@@ -1,14 +1,14 @@
|
|
1
|
-
# Conditions are like questions.
|
2
|
-
# They allow a program to decide to take one action if
|
1
|
+
# Conditions are like questions.
|
2
|
+
# They allow a program to decide to take one action if
|
3
3
|
# the answer to a question is true or to do another action
|
4
|
-
# if the answer to the question is false.
|
4
|
+
# if the answer to the question is false.
|
5
5
|
# The questions asked within a program are always logical
|
6
|
-
# or relational statements. For example, if the variable 'i' is
|
6
|
+
# or relational statements. For example, if the variable 'i' is
|
7
7
|
# "even" then draw short line, else draw a long one.
|
8
8
|
|
9
9
|
|
10
10
|
def setup
|
11
|
-
size 640, 360
|
11
|
+
size 640, 360
|
12
12
|
background 0
|
13
13
|
stroke_weight 8
|
14
14
|
(5 ... width/2).step(5) do |i|
|
@@ -25,22 +25,3 @@ def draw_long(i)
|
|
25
25
|
stroke 153
|
26
26
|
line i * 2, 20, i * 2, 180
|
27
27
|
end
|
28
|
-
|
29
|
-
|
30
|
-
# Ruby allows us to extend base classes, such as numbers, with
|
31
|
-
# methods of our choosing. In this case we'll add methods that tell
|
32
|
-
# you whether a given integer is divisible by 2, which here we declare
|
33
|
-
# as even or odd.
|
34
|
-
|
35
|
-
class Fixnum
|
36
|
-
|
37
|
-
def even?
|
38
|
-
self % 2 == 0
|
39
|
-
end
|
40
|
-
|
41
|
-
def odd?
|
42
|
-
!even?
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
@@ -12,7 +12,7 @@ def setup
|
|
12
12
|
@brick_layers = 18
|
13
13
|
@brick_width, @brick_height, @brick_depth = 60, 25, 25
|
14
14
|
@radius = 175.0
|
15
|
-
@angle = 0
|
15
|
+
@angle = 0
|
16
16
|
@brick = Cubeish.new(@brick_width, @brick_height, @brick_depth)
|
17
17
|
end
|
18
18
|
|
@@ -24,7 +24,7 @@ def draw
|
|
24
24
|
lights
|
25
25
|
translate(width / 2.0, height * 1.2, -380) # move viewpoint into position
|
26
26
|
rotate_x(-45.radians) # tip tower to see inside
|
27
|
-
rotate_y(frame_count * PI/600) # slowly rotate tower
|
27
|
+
rotate_y(frame_count * PI / 600) # slowly rotate tower
|
28
28
|
brick_layers.times { |i| draw_layer(i) }
|
29
29
|
end
|
30
30
|
|
@@ -42,9 +42,8 @@ def draw_bricks(brick_num)
|
|
42
42
|
translate temp_x, temp_y, temp_z
|
43
43
|
rotate_y(angle.radians)
|
44
44
|
top_layer = layer_num == brick_layers - 1
|
45
|
-
even_brick = brick_num % 2 == 0
|
46
45
|
brick.create unless top_layer # main tower
|
47
|
-
brick.create if top_layer &&
|
46
|
+
brick.create if top_layer && brick_num.even? # add crenelation
|
48
47
|
pop_matrix
|
49
48
|
@angle += 360.0 / bricks_per_layer
|
50
49
|
end
|
@@ -65,13 +64,11 @@ class Cubeish
|
|
65
64
|
top: ['-- ', '---', ' --', ' - '],
|
66
65
|
bottom: ['- ', '- -', ' -', ' ']}
|
67
66
|
|
68
|
-
SIGNS = {'-' => -1,
|
69
|
-
' ' => 1}
|
67
|
+
SIGNS = {'-' => -1, ' ' => 1}
|
70
68
|
|
71
69
|
def initialize(width, height, depth)
|
72
70
|
@vertices = {}
|
73
71
|
@w, @h, @d = width, height, depth
|
74
|
-
|
75
72
|
SIDES.each do |side, signs|
|
76
73
|
vertices[side] = signs.map do |s|
|
77
74
|
s = s.split('').map { |el| SIGNS[el] }
|
@@ -87,7 +84,6 @@ class Cubeish
|
|
87
84
|
end_shape
|
88
85
|
end
|
89
86
|
end
|
90
|
-
|
91
87
|
end
|
92
88
|
|
93
89
|
Vect = Struct.new(:x, :y, :z)
|
@@ -16,8 +16,8 @@ def setup
|
|
16
16
|
@dx = [] # Value for incrementing X, to be calculated as a function of period and x_spacing
|
17
17
|
|
18
18
|
@max_waves.times do |i|
|
19
|
-
amplitude << rand(10
|
20
|
-
period = rand(100
|
19
|
+
amplitude << rand(10..30)
|
20
|
+
period = rand(100..300) # How many pixels before the wave repeats
|
21
21
|
dx << (TAU / period) * @x_spacing
|
22
22
|
end
|
23
23
|
|
@@ -22,9 +22,9 @@ def draw
|
|
22
22
|
background 0
|
23
23
|
rand_y = 0.0
|
24
24
|
(1 ... steps).each do |i|
|
25
|
-
noise_y = (rand_y > 0)? rand(-rand_y
|
25
|
+
noise_y = (rand_y > 0)? rand(-rand_y..rand_y) : rand(rand_y..-rand_y)
|
26
26
|
point( (width/steps) * i, (height/2) + noise_y )
|
27
|
-
rand_y += rand(-5
|
27
|
+
rand_y += rand(-5..5)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -23,7 +23,7 @@ def draw
|
|
23
23
|
# xoff = yoff # Option #2: 1D Noise
|
24
24
|
|
25
25
|
# Iterate over horizontal pixels
|
26
|
-
(0
|
26
|
+
(0..width).step(10) do |x|
|
27
27
|
# Calculate a y value according to noise, map to
|
28
28
|
y = map(noise(xoff, yoff), 0, 1, 200,300) # Option #1: 2D Noise
|
29
29
|
# y = map(noise(xoff), 0, 1, 200,300) # Option #2: 1D Noise
|
@@ -62,7 +62,7 @@ class Particle
|
|
62
62
|
attr_reader :loc, :vel, :acc, :lifespan
|
63
63
|
def initialize(loc)
|
64
64
|
@acc = Vec2D.new(0, 0.05)
|
65
|
-
@vel = Vec2D.new(rand(-1.0
|
65
|
+
@vel = Vec2D.new(rand(-1.0..1), rand(-2.0..0))
|
66
66
|
@loc = loc # loc.clone is unecessary in ruby
|
67
67
|
@lifespan = 255.0
|
68
68
|
end
|
@@ -1,25 +1,30 @@
|
|
1
|
-
# No Loop.
|
2
|
-
#
|
1
|
+
# No Loop.
|
2
|
+
#
|
3
3
|
# The noLoop() function causes draw() to only
|
4
4
|
# execute once. Without calling noLoop(), draw()
|
5
|
-
# executed continually.
|
6
|
-
attr_reader :y
|
5
|
+
# executed continually.
|
6
|
+
attr_reader :y, :clicked
|
7
7
|
|
8
|
-
def setup
|
9
|
-
size 640, 360
|
10
|
-
@y = height / 2
|
8
|
+
def setup
|
9
|
+
size 640, 360
|
10
|
+
@y = height / 2
|
11
11
|
stroke 255
|
12
|
-
frame_rate 30
|
13
|
-
|
12
|
+
frame_rate 30
|
13
|
+
@clicked = true
|
14
14
|
end
|
15
15
|
|
16
|
-
def draw
|
17
|
-
background 0
|
16
|
+
def draw
|
17
|
+
background 0
|
18
18
|
@y = y - 1
|
19
|
-
@y = height if y < 0
|
19
|
+
@y = height if y < 0
|
20
20
|
line 0, y, width, y
|
21
|
-
end
|
21
|
+
end
|
22
22
|
|
23
23
|
def mouse_pressed
|
24
|
-
|
24
|
+
unless clicked
|
25
|
+
no_loop
|
26
|
+
else
|
27
|
+
loop
|
28
|
+
end
|
29
|
+
@clicked = !clicked
|
25
30
|
end
|
@@ -12,9 +12,9 @@ def draw_circle (x, y, radius, level)
|
|
12
12
|
ellipse x, y, radius * 2, radius * 2
|
13
13
|
if level > 1
|
14
14
|
level = level - 1
|
15
|
-
num = rand(2
|
15
|
+
num = rand(2..6)
|
16
16
|
0.upto(num-1) do |i|
|
17
|
-
a = rand(0
|
17
|
+
a = rand(0..TAU)
|
18
18
|
nx = x + cos(a) * 8.0 * level
|
19
19
|
ny = y + sin(a) * 6.0 * level
|
20
20
|
draw_circle nx, ny, radius / 2, level
|
@@ -1,64 +1,44 @@
|
|
1
|
-
# Texture 3.
|
2
|
-
#
|
3
|
-
# Load an image and draw it onto a cylinder and a quad.
|
1
|
+
# Texture 3.
|
2
|
+
#
|
3
|
+
# Load an image and draw it onto a cylinder and a quad.
|
4
4
|
|
5
5
|
attr_reader :tube_res, :tube_x, :tube_y, :img
|
6
6
|
|
7
7
|
def setup
|
8
|
-
|
9
8
|
size 640, 360, P3D
|
10
|
-
|
11
9
|
@tube_res = 32
|
12
10
|
@tube_x = []
|
13
11
|
@tube_y = []
|
14
|
-
|
15
|
-
@img = load_image "berlin-1.jpg"
|
16
|
-
|
12
|
+
@img = load_image 'berlin-1.jpg'
|
17
13
|
angle = 270.0 / tube_res
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
tube_y.push sin( radians( i * angle ) )
|
14
|
+
(0 ... tube_res).each { |i|
|
15
|
+
tube_x.push cos((i * angle).radians)
|
16
|
+
tube_y.push sin((i * angle).radians)
|
22
17
|
}
|
23
|
-
|
24
18
|
no_stroke
|
25
|
-
|
26
19
|
end
|
27
20
|
|
28
21
|
def draw
|
29
|
-
|
30
22
|
background 0
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
rotate_y map( mouse_x, 0, width, -PI, PI )
|
35
|
-
|
23
|
+
translate width / 2, height / 2
|
24
|
+
rotate_x map1d(mouse_y, (0..height), (-PI..PI))
|
25
|
+
rotate_y map1d(mouse_x, (0..width), (-PI..PI))
|
36
26
|
begin_shape QUAD_STRIP
|
37
|
-
|
38
27
|
texture img
|
39
|
-
|
40
|
-
(0...tube_res).each { |i|
|
41
|
-
|
28
|
+
(0 ... tube_res).each { |i|
|
42
29
|
x = tube_x[i] * 100
|
43
30
|
z = tube_y[i] * 100
|
44
31
|
u = img.width / tube_res * i
|
45
|
-
|
46
32
|
vertex x, -100, z, u, 0
|
47
33
|
vertex x, 100, z, u, img.height
|
48
|
-
|
49
34
|
}
|
50
|
-
|
51
35
|
end_shape
|
52
|
-
|
53
36
|
begin_shape QUADS
|
54
|
-
|
55
37
|
texture img
|
56
|
-
|
57
38
|
vertex 0, -100, 0, 0, 0
|
58
39
|
vertex 100, -100, 0, 100, 0
|
59
40
|
vertex 100, 100, 0, 100, 100
|
60
41
|
vertex 0, 100, 0, 0, 100
|
61
|
-
|
62
42
|
end_shape
|
63
|
-
|
64
|
-
end
|
43
|
+
|
44
|
+
end
|
@@ -13,11 +13,11 @@ def setup
|
|
13
13
|
size 640, 360, P3D
|
14
14
|
no_stroke
|
15
15
|
lights
|
16
|
-
@birds = (0
|
17
|
-
Bird.new(rand(-300
|
18
|
-
.set_flight(rand(20
|
19
|
-
.set_wing_speed(rand(0.1
|
20
|
-
.set_rot_speed(rand(0.025
|
16
|
+
@birds = (0..BIRD_COUNT).map {
|
17
|
+
Bird.new(rand(-300..300), rand(-300..300), rand(-2500..-500), rand(5..30), rand(5..30))
|
18
|
+
.set_flight(rand(20..340), rand(30..350), rand( 1000..4800 ), rand(-160..160), rand(-55..55), rand(-20..20))
|
19
|
+
.set_wing_speed(rand(0.1..3.75))
|
20
|
+
.set_rot_speed(rand(0.025..0.15))
|
21
21
|
}
|
22
22
|
end
|
23
23
|
|
@@ -20,11 +20,11 @@ def setup
|
|
20
20
|
@cubes = []
|
21
21
|
|
22
22
|
0.upto( @cube_count ) do |i|
|
23
|
-
cube_size = rand(5
|
23
|
+
cube_size = rand(5..15)
|
24
24
|
c = Cube.new(cube_size)
|
25
25
|
c.position = Vec3D.new(0.0, 0.0, 0.0)
|
26
|
-
c.speed = Vec3D.new(rand(-1.0
|
27
|
-
c.rotation = Vec3D.new(rand(40
|
26
|
+
c.speed = Vec3D.new(rand(-1.0..1), rand(-1.0..1), rand(-1.0..1))
|
27
|
+
c.rotation = Vec3D.new(rand(40..100), rand(40..100), rand(40..100))
|
28
28
|
@cubes << c
|
29
29
|
end
|
30
30
|
|