Skip to content

Commit 2a98d1f

Browse files
committed
remove FX2D examples
1 parent 97799c7 commit 2a98d1f

File tree

14 files changed

+102
-13
lines changed

14 files changed

+102
-13
lines changed

contributed/recursive_pentagon.rb

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/usr/bin/env jruby
2+
require 'propane'# After an openprocessing sketch by C.Andrews
3+
class RecursivePentagons < Propane::App
4+
attr_reader :strut_factor, :renderer
5+
6+
def setup
7+
sketch_title 'Recursive Pentagons'
8+
@strut_factor = 0.2
9+
@renderer = AppRender.new self # so we can send Vec2D :to_vertex
10+
background 0
11+
end
12+
13+
def draw
14+
translate(width / 2, height / 2)
15+
angle = TWO_PI / 5
16+
radius = width * 0.7
17+
points = (0...5).map do |i|
18+
x = radius * cos(angle * i)
19+
y = radius * sin(angle * i)
20+
Vec2D.new(x, y)
21+
end
22+
fractal = PentagonFractal.new(points, 5)
23+
fractal.draw
24+
end
25+
26+
def settings
27+
size(800, 800)
28+
end
29+
end
30+
31+
RecursivePentagons.new
32+
33+
# Here we include Processing::Proxy to mimic vanilla processing inner class
34+
# access.
35+
class PentagonFractal
36+
include Propane::Proxy
37+
attr_reader :points ,:branches, :level, :midpoints, :innerpoints
38+
COLOURS = %w[#ff0000 #00ff00 #00ffff #0000ff #0000ff #ffffff]
39+
40+
def initialize(points, levels)
41+
@points = points
42+
@level = levels
43+
return if level.zero? # so called guard clause in ruby simplifies code
44+
45+
@midpoints = (0...5).map do |i| # build an array of midpoints
46+
midpoint(points[i], points[(i + 1) % 5])
47+
end
48+
@innerpoints = (0...5).map do |i| # build an array of inner points
49+
opposite = points[(i + 3) % 5]
50+
x = midpoints[i].x + (opposite.x - midpoints[i].x) * strut_factor
51+
y = midpoints[i].y + (opposite.y - midpoints[i].y) * strut_factor
52+
Vec2D.new(x, y)
53+
end
54+
# Create the PentagonFractal objects representing the six inner
55+
# pentagons
56+
# the shape is very regular, so we can build the ring of five
57+
@branches = (0...5).map do |i|
58+
p = [
59+
midpoints[i],
60+
innerpoints[i],
61+
innerpoints[(i + 1) % 5],
62+
midpoints[(i + 1) % 5],
63+
points[(i + 1) % 5]
64+
]
65+
PentagonFractal.new(p, level - 1)
66+
end
67+
# add the final innermost pentagon
68+
branches << PentagonFractal.new(innerpoints, level - 1)
69+
end
70+
# This is a simple helper function that takes in two points (as Vec2D) and
71+
# returns the midpoint between them as Vec2D.
72+
def midpoint(point1, point2)
73+
(point2 + point1) * 0.5
74+
end
75+
76+
def draw
77+
stroke 255
78+
no_fill
79+
begin_shape
80+
stroke_weight 0.5 + 0.75 * level
81+
stroke color(COLOURS[level]), 100
82+
points.each do |point|
83+
point.to_vertex(renderer)
84+
end
85+
end_shape CLOSE
86+
return if level.zero?
87+
branches.each(&:draw)
88+
end
89+
end

external_library/java/handy/preset_style_demo.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def settings
4242
# Should work with all Processing 3 renderers.
4343
# size(1200, 800, P2D)
4444
# size(1200, 800, P3D)
45-
# size(1200, 800, FX2D)
45+
# size(1200, 800)
4646
pixelDensity(displayDensity) # Use platform's maximum display density.
4747
end
4848

processing_app/basics/arrays/array_objects.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def draw
2424
end
2525

2626
def settings
27-
size 640, 360, FX2D
27+
size 640, 360
2828
end
2929

3030
module Runnable

processing_app/basics/arrays/custom_array.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def draw
2424
end
2525

2626
def settings
27-
size 640, 360, FX2D
27+
size 640, 360
2828
end
2929

3030
# The Particle object

processing_app/basics/color/blend_color.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def draw
2525
end
2626

2727
def settings
28-
size 100, 100, FX2D
28+
size 100, 100
2929
end
3030
end
3131

processing_app/basics/color/color_wheel.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def mouse_pressed
9393
end
9494

9595
def settings
96-
size 640, 360, FX2D
96+
size 640, 360
9797
end
9898
end
9999

processing_app/basics/color/saturation.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def draw
2626
end
2727

2828
def settings
29-
size 640, 360, FX2D
29+
size 640, 360
3030
end
3131
end
3232

processing_app/demos/performance/text_rendering.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def draw
1919
end
2020

2121
def settings
22-
size(800, 600, FX2D)
22+
size(800, 600)
2323
end
2424
end
2525

processing_app/demos/tests/no_background_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def draw
1515
end
1616

1717
def settings
18-
size(400, 400, FX2D)
18+
size(400, 400)
1919
end
2020
end
2121

processing_app/demos/tests/redraw_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def key_pressed
2020
end
2121

2222
def settings
23-
size(400, 400, FX2D)
23+
size(400, 400)
2424
end
2525
end
2626

processing_app/demos/tests/resize_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def draw
1616
end
1717

1818
def settings
19-
size(400, 400, FX2D)
19+
size(400, 400)
2020
end
2121
end
2222

processing_app/topics/advanced_data/load_save_json.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def draw
2525
end
2626

2727
def settings
28-
size 640, 360, FX2D
28+
size 640, 360
2929
end
3030

3131
def mouse_pressed

processing_app/topics/gui/rollover.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def over_circle?(x, y, diameter)
6262
end
6363

6464
def settings
65-
size 640, 360, FX2D
65+
size 640, 360
6666
smooth(4)
6767
end
6868
end

processing_app/topics/lsystems/cstest.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def draw
2929
end
3030

3131
def settings
32-
size 125, 250, FX2D
32+
size 125, 250
3333
end
3434
end
3535

0 commit comments

Comments
 (0)