# # Inspired by: # 10 PRINT CHR$(205.5+RND(1)) : GOTO 10 # # Sketch by: # Jacob Joaquin # jacobjoaquin@gmail.com # twitter @jacobjoaquin # ODDS = 0.618 attr_reader :num_tiles_x, :num_tiles_y, :tile_size, :c1, :c2 def setup size 800, 800 @tile_size = 50 @num_tiles_x = width / tile_size @num_tiles_y = height / tile_size @c2 = color(235, 70, 47) @c1 = color(255) background c2 fill c1 no_stroke no_loop end def draw do_maze end def key_pressed case key when 'q' resize_tile 2 when 'w' resize_tile 0.5 when 's' save "maze_sketch.png" end end def key_released case key when 'q', 'w' background c2 redraw end end def resize_tile v @tile_size *= v @tile_size *= v @num_tiles_x = width / tile_size @num_tiles_y = height / tile_size end def do_maze (-1 .. num_tiles_x).each do |i| (-1 .. num_tiles_y).each do |j| x1, y1 = i * tile_size, j * tile_size x2, y2 = x1, y1 + tile_size d = height / (tile_size / 2) n = y1 / d x = y2 / d if (rand > ODDS) x1 += tile_size quad(x1, y1 - n, x1 + n, y1, x2, y2 + x, x2 - x, y2) else x2 += tile_size quad(x1 - n, y1, x1, y1 - n, x2 + x, y2, x2, y2 + x) end end end end
Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Saturday, 13 July 2013
Yet Another 10 PRINT sketch in ruby-processing
Added some tweaks for smoother operation ie key_pressed/key_released to sequence action. See at open processing here.
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2013
(94)
-
▼
July
(8)
- Clobbering archived files in a github repository
- Fibonacci Sphere in Ruby Processing
- A simple ruby-processing paint application
- Using Threads in Ruby-Processing
- Yet Another 10 PRINT sketch in ruby-processing
- Another 10 PRINT sketch translated to ruby-processing
- Minimalist Perlin noise sketch in ruby-processing
- Setting texture sampling ruby-processing-2.0
-
▼
July
(8)
About Me
- monkstone
- I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2
No comments:
Post a Comment