Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merging in monkstone's triangle patch and additional samples
- Loading branch information
Showing
10 changed files
with
112 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,59 @@ | ||
# creature.rb ruby-processing | ||
# contributed by monkstone | ||
|
||
load_library 'context_free' | ||
|
||
def setup_the_creature | ||
@creature = ContextFree.define do | ||
rule :start do | ||
rot = 0 | ||
split do | ||
11.times do # 11 times increment rotation by 30 degrees | ||
legs :rotation => rot | ||
rot += 30 | ||
rewind # rewind context | ||
end | ||
legs :rotation => 360 | ||
end | ||
end | ||
rule :legs do | ||
circle :hue => 0.15, :saturation => 0.5, :brightness => 1.0, :color => [0.95, 0.15] | ||
legs :y => 0.1, :size => 0.965 | ||
end | ||
rule :legs, 0.01 do | ||
circle | ||
split do | ||
legs :rotation => 3 | ||
rewind | ||
legs :rotation => -3 | ||
end | ||
end | ||
@creature = ContextFree.define do | ||
|
||
rule :start do | ||
rot = 0 | ||
split do | ||
11.times do # 11 times increment rotation by 30 degrees | ||
legs :rotation => rot | ||
rot += 30 | ||
rewind # rewind context | ||
end | ||
legs :rotation => 360 | ||
end | ||
end | ||
|
||
rule :legs do | ||
circle :hue => 0.15, :saturation => 0.5, :brightness => 1.0, :color => [0.95, 0.15] | ||
legs :y => 0.1, :size => 0.965 | ||
end | ||
|
||
rule :legs, 0.01 do | ||
circle | ||
split do | ||
legs :rotation => 3 | ||
rewind | ||
legs :rotation => -3 | ||
end | ||
end | ||
|
||
end | ||
end | ||
|
||
def setup | ||
size 600, 600 | ||
setup_the_creature | ||
no_stroke | ||
color_mode HSB, 1.0 | ||
smooth | ||
draw_it | ||
save_frame("creature.png") | ||
size 600, 600 | ||
setup_the_creature | ||
no_stroke | ||
color_mode HSB, 1.0 | ||
smooth | ||
draw_it | ||
# save_frame("creature.png") | ||
end | ||
|
||
|
||
def draw | ||
# Do nothing. | ||
# Do nothing. | ||
end | ||
|
||
|
||
def draw_it | ||
background -1.0 | ||
@creature.render :start, :size => height/5, :stop_size => 0.8, | ||
:start_x => width/2, :start_y => height/3, :color => [0.75, 0.1, 0.9] | ||
background -1.0 | ||
@creature.render :start, :size => height/5, :stop_size => 0.8, | ||
:start_x => width/2, :start_y => height/3, :color => [0.75, 0.1, 0.9] | ||
end | ||
|
||
|
||
def mouse_clicked | ||
draw_it | ||
draw_it | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,51 @@ | ||
# dark_star.rb ruby-processing | ||
# contributed by monkstone | ||
|
||
load_library 'context_free' | ||
|
||
def setup_the_sun | ||
@sun = ContextFree.define do | ||
rule :start do | ||
rot = 0 | ||
split do | ||
12.times do | ||
legs :rotation => rot | ||
rot += 30 | ||
rewind | ||
end | ||
legs :rotation => 360 | ||
end | ||
end | ||
rule :legs do | ||
circle | ||
legs :rotation => 1, :y => 0.1, | ||
:size => 0.965, :color => [0.22, 0.15], :alpha => 0.5 | ||
end | ||
@sun = ContextFree.define do | ||
|
||
rule :start do | ||
rot = 0 | ||
split do | ||
12.times do | ||
legs :rotation => rot | ||
rot += 30 | ||
rewind | ||
end | ||
legs :rotation => 360 | ||
end | ||
end | ||
|
||
rule :legs do | ||
circle | ||
legs :rotation => 1, :y => 0.1, | ||
:size => 0.973, :color => [0.22, 0.15], :alpha => 0.5 | ||
end | ||
|
||
end | ||
end | ||
|
||
def setup | ||
size 600, 600 | ||
setup_the_sun | ||
no_stroke | ||
color_mode HSB, 1.0 | ||
smooth | ||
draw_it | ||
save_frame("sun.png") | ||
size 600, 600 | ||
setup_the_sun | ||
no_stroke | ||
color_mode HSB, 1.0 | ||
smooth | ||
draw_it | ||
# save_frame("sun.png") | ||
end | ||
|
||
|
||
def draw | ||
# Do nothing. | ||
# Do nothing. | ||
end | ||
|
||
|
||
def draw_it | ||
background 1.0 | ||
@sun.render :start, :size => height/7, :stop_size => 0.8, | ||
:start_x => width/2, :start_y => height/2 | ||
background 0.7 | ||
@sun.render :start, :size => height/7, :stop_size => 0.8, | ||
:start_x => width/2, :start_y => height/2 | ||
end | ||
|
||
|
||
def mouse_clicked | ||
draw_it | ||
draw_it | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../context_free.rb |
Oops, something went wrong.