Skip to content

Commit 52bb99e

Browse files
committed
add wovns
1 parent 76e86d5 commit 52bb99e

File tree

16 files changed

+411
-53
lines changed

16 files changed

+411
-53
lines changed

contributed/25_squares.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# Vera Molnar – 25 Squares
44
# # # # #
55
# Interpretation by Martin Vögeli
6-
# Converted to propane Martin Prout
7-
# features the :grid convenience method
6+
# Converted to JRubyArt Martin Prout
87
# # # # #
98
# Based on code by Indae Hwang and Jon McCormack
109
def settings
@@ -25,10 +24,9 @@ def draw
2524
# calculate the size of each square for the given number of squares and gap between them
2625
cellsize = (width - (grid_size + 1) * gap) / grid_size
2726
position = -> (count) { gap * (count + 1) + cellsize * count + rand(-5..5) }
28-
grid(grid_size, grid_size) do |i, j| # the grid convenience method takes a block
29-
# Note how to create transparent fill with web color JRubyArt
27+
grid(grid_size, grid_size) do |x, y|
3028
rand(0..5) > 4 ? fill(color('#a11220'), 180.0) : fill(color('#884444'), 180.0)
31-
rect(position.call(i), position.call(j), cellsize, cellsize)
29+
rect(position.call(x), position.call(y), cellsize, cellsize)
3230
end
3331
# save your drawings when you press keyboard 's' continually
3432
save_frame('######.jpg') if key_pressed? && key == 's'

contributed/full_screen.rb

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
# Description:
2-
# This is a full-screen demo
3-
# Since processing-3.0a10 set in settings
2+
# This is a full-screen demo
3+
# Using JRubyArt grid method
44

5-
class FullScreen < Processing::App
6-
def setup
7-
sketch_title 'Full Screen'
8-
no_stroke
9-
end
5+
GRID_SIZE = 100
6+
HALF = 50
107

11-
def draw
12-
lights
13-
background 0
14-
fill 120, 160, 220
15-
(width/100).times do |x|
16-
(height/100).times do |y|
17-
new_x, new_y = x * 100, y * 100
18-
push_matrix
19-
translate new_x + 50, new_y + 50
20-
rotate_y(((mouse_x.to_f + new_x) / width) * Math::PI)
21-
rotate_x(((mouse_y.to_f + new_y) / height) * Math::PI)
22-
box 90
23-
pop_matrix
24-
end
25-
end
26-
end
8+
def setup
9+
sketch_title 'Full Screen'
10+
no_stroke
11+
end
2712

28-
def settings
29-
full_screen P3D
13+
def draw
14+
lights
15+
background 0
16+
fill 120, 160, 220
17+
grid(width, height, GRID_SIZE, GRID_SIZE) do |x, y|
18+
push_matrix
19+
translate x + HALF, y + GRID_SIZE
20+
rotate_y(((mouse_x.to_f + x) / width) * Math::PI)
21+
rotate_x(((mouse_y.to_f + y) / height) * Math::PI)
22+
box 90
23+
pop_matrix
3024
end
3125
end
3226

27+
def settings
28+
full_screen(P3D)
29+
end

contributed/plain.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ def draw
1616
background 0
1717
fill 120, 160, 220
1818
stroke 0
19-
rect_mode(CENTER)
20-
(dim..width - dim).step(dim) do |x|
21-
(dim..height - dim).step(dim) do |y|
22-
rect x, y, dim, dim, rnd, rnd, rnd, rnd
23-
end
19+
#rect_mode(CENTER)
20+
# (dim..width - dim).step(dim) do |x|
21+
# (dim..height - dim).step(dim) do |y|
22+
# rect x, y, dim, dim, rnd, rnd, rnd, rnd
23+
# end
24+
# end
25+
grid(width, height, dim, dim) do |x, y|
26+
rect x, y, dim, dim, rnd, rnd, rnd, rnd
2427
end
2528
end
2629

examples/WOVNS/cross_hatch.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Divan Quality, Landscape 1 Palette
2+
# This draws a cross-hatch pattern, i.e. a grid of cells, each of which contains
3+
# multiple lines. The lines in each cell alternate between horizontal and vertical.
4+
5+
# the number of stripes to draw in each cell of the grid
6+
NUM_STRIPES = 5
7+
8+
def settings
9+
size(2400, 6372) # 13.5" x 36", 177 DPI
10+
no_smooth
11+
end
12+
13+
def setup
14+
sketch_title 'Cross Hatch'
15+
background(color('#050406')) # Black Satin
16+
stroke(color('#C2C2BF')) # Pearl
17+
strokeWeight(10) # draw lines 10 pixels thick
18+
# the width and height of each cell of the grid
19+
w = width / 18
20+
h = height / 48
21+
# the distance between stripes
22+
w2 = w / NUM_STRIPES
23+
h2 = h / NUM_STRIPES
24+
grid(w, h) do |col, row|
25+
(0..NUM_STRIPES).each do |i|
26+
if (row + col).even?
27+
# horizontal lines
28+
line(w * col + w2 / 2, h * row + i * h2 + h2 / 2,
29+
w * (col + 1) - w2 / 2, h * row + i * h2 + h2 / 2)
30+
else
31+
# vertical lines
32+
line(w * col + i * w2 + w2 / 2, h * row + h2 / 2,
33+
w * col + i * w2 + w2 / 2, h * (row + 1) - h2 / 2)
34+
end
35+
end
36+
end
37+
save(data_path('hatch.png'))
38+
end

examples/WOVNS/data/circles.svg

Lines changed: 15 additions & 0 deletions
Loading

examples/WOVNS/data/java_args.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-XX:InlineSmallCode=500 -Xms1024m -Xmx2048m

examples/WOVNS/gaussian.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Talma Quality, Spectrum 19 Palette
2+
GRID = 7 # 1/12"
3+
4+
def settings
5+
size(3984, 3000)
6+
no_smooth
7+
end
8+
9+
def setup
10+
sketch_title 'Random gaussian'
11+
background(color('#8B8795')) # Suva
12+
no_stroke
13+
fill(color('#302D32')) # Matte Black
14+
0.step(by: GRID, to: width) do |x|
15+
# threshold based on a gaussian function (bell curve) that gives
16+
# a number between 1 in the middle of the screen and 0 at the left
17+
# and right edges. the 8.0 adjusts the width of the bell, i.e.
18+
# how quickly the value drops to 0 as you move towards the edges of
19+
# the screen.
20+
threshold = Math.exp(-8.0 * (0.5 - (x.to_f / width)) * (0.5 - (x.to_f / width)))
21+
0.step(by: GRID, to: height) do |y|
22+
# generate a random number between 0 and 1 and compare it to the
23+
# threshold. if it's less than the threshold, draw a small square.
24+
rect(x, y, GRID, GRID) if (rand < threshold)
25+
end
26+
end
27+
save(data_path('gaussian.png'))
28+
end

examples/WOVNS/geometric_grid4.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Divan Quality, Pastel 2 Palette
2+
PALETTE = %w(#D1D2EA #BFCDE5 #ABC1E5 #EEC3C3 #FFE4F3 #FFEEF8).freeze
3+
STEP = 133
4+
5+
def settings
6+
size(2400, 6372) # 13.5" x 36", 177 DPI
7+
no_smooth
8+
end
9+
10+
attr_reader :couluers
11+
12+
def setup
13+
sketch_title 'Geometric Grid'
14+
@couluers = web_to_color_array(PALETTE)
15+
background(color('#6984B8')) # Buscabulla
16+
no_stroke
17+
w = width / 18
18+
h = height / 48
19+
grid(width, height, STEP, STEP - 1) do |col, row|
20+
fill(couluers[(row * 1 / 132).to_i % couluers.length])
21+
rect(col + w / 8, row + h / 8, w * 3 / 4, h * 3 / 4)
22+
end
23+
save(data_path('grid.png'))
24+
end

examples/WOVNS/plaid.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Talma Quality, Landscape 18 Palette
2+
INCH = 84
3+
STRPE = INCH * 3
4+
5+
def settings
6+
size(3984, 3000) # 46-48" x 36" at 84 DPI
7+
no_smooth #
8+
end
9+
10+
def setup
11+
sketch_title 'Plaid'
12+
background(color('#000500')) # Black Feather
13+
no_stroke # Draw vertical stripes every three inches.
14+
fill(color('#0D644C')) # Malachite
15+
0.step(by: STRPE, to: width) do |x|
16+
rect(x, 0, INCH, height) # one inch wide, full-height stripes
17+
end
18+
# Draw stripes every three inches along the height.
19+
fill(color('#B9B34B')) # Black & Gold
20+
0.step(by: STRPE, to: height) do |y|
21+
# For each value of y, draw five stripes, at:
22+
# y, y + 21, y + 42, y + 63, and y + 84.
23+
5.times do |i|
24+
rect(0, y + i * 21, width, 10)
25+
end
26+
end
27+
# Combine the two loops (using JRubyArt grid) to draw a different color where
28+
# the horizontal and vertical stripes intersect.
29+
fill(color('#6A8E51')) # Peridot
30+
grid(width, height, STRPE, STRPE) do |x, y|
31+
5.times do |i|
32+
rect(x, y + i * 21, INCH, 10)
33+
end
34+
end
35+
save(data_path('plaid.png'))
36+
end

examples/WOVNS/random_grid.rb

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# takes quite a long time to render
2+
PALETTE = %w(#74AED7 #FFE4F3 #FEE597).freeze
3+
COULEURS = %i(ciel pinking yolk).freeze
4+
STEP = 84
5+
attr_reader :shapes, :web
6+
7+
def settings
8+
size 2400, 6372, P2D
9+
end
10+
11+
def setup
12+
sketch_title 'Random Grid'
13+
@web = COULEURS.zip(web_to_color_array(PALETTE)).to_h
14+
no_stroke
15+
shapeOne = createShape(ELLIPSE, 0, 0, 20, 20)
16+
shapeOne.setFill(web[:pinking])
17+
shapeTwo = createShape(GROUP)
18+
one = createShape(ELLIPSE, 42, 42, 20, 20)
19+
one.setFill(web[:pinking])
20+
two = createShape(ELLIPSE, 21, 21, 20, 20)
21+
one.setFill(web[:yolk])
22+
shapeTwo.addChild(one)
23+
shapeTwo.addChild(two)
24+
shapeThree = createShape(GROUP)
25+
base = createShape(ELLIPSE, 0, 0, 20, 20)
26+
base.setFill(web[:pinking])
27+
three = createShape(ELLIPSE, 21, 21, 20, 20)
28+
three.setFill(web[:pinking])
29+
four = createShape(ELLIPSE, 42, 42, 20, 20)
30+
four.setFill(web[:yolk])
31+
shapeThree.addChild(base)
32+
shapeThree.addChild(three)
33+
shapeThree.addChild(four)
34+
shapeFour = createShape(GROUP)
35+
five = createShape(ELLIPSE, 0, 0, 20, 20)
36+
five.setFill(web[:pinking])
37+
six = createShape(ELLIPSE, 21, 21, 20, 20)
38+
six.setFill(web[:pinking])
39+
seven = createShape(ELLIPSE, 42, 42, 20, 20)
40+
seven.setFill(web[:pinking])
41+
eight = createShape(ELLIPSE, 63, 63, 20, 20)
42+
eight.setFill(web[:yolk])
43+
shapeFour.addChild(five)
44+
shapeFour.addChild(six)
45+
shapeFour.addChild(seven)
46+
shapeFour.addChild(eight)
47+
@shapes = [shapeOne, shapeTwo, shapeThree, shapeFour]
48+
end
49+
50+
def draw
51+
background(web[:ciel]) # Sky blue
52+
grid(width, height, STEP, STEP) do |col, row|
53+
push_matrix
54+
translate col, row
55+
rkey = rand(0..6)
56+
shape(shapes[rkey]) if rkey < 4
57+
pop_matrix
58+
end
59+
save(data_path('random.png'))
60+
no_loop
61+
end

0 commit comments

Comments
 (0)