Revisions
-
toothrot revised this gist
Mar 16, 2009 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
Empty file.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -13,8 +13,8 @@ def names_n_colors(people, colors) background black names_n_colors = colors.zip(people).map do |color, person| flow(:height => 70, :width => 200) do border color, :strokewidth => 2 my_label = subtitle person, :stroke => white fill @previous_color.next rotate(90) a = arrow(104, 5, 30) @@ -41,4 +41,4 @@ def swap_next(array, item) array end names_n_colors(people, colors) end -
evanfarrar created this gist
Mar 16, 2009 .There are no files selected for viewing
Empty file.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ Shoes.app(:width => 200, :height => 70 * 4 + 40) do background black colors = [red, blue, green, yellow] people = ["steve","ed","nick","tom"] @next_color = colors.cycle @next_color.next @previous_color = colors.cycle (colors.length - 1).times { @previous_color.next } def names_n_colors(people, colors) clear do background black names_n_colors = colors.zip(people).map do |color, person| flow(:height => 70, :width => 200) do border color my_label = subtitle person, :stroke => color fill @previous_color.next rotate(90) a = arrow(104, 5, 30) a.click { names_n_colors(swap_previous(people, person), colors) } fill @next_color.next rotate(180) a = arrow(90, 45, 30) a.click { names_n_colors(swap_next(people, person), colors) } end end button "ok!" end end def swap_previous(array, item) idx = array.index(item) array[(idx-1) % array.length],array[idx] = array[idx],array[(idx-1) % array.length] array end def swap_next(array, item) idx = array.index(item) array[(idx+1) % array.length],array[idx] = array[idx],array[(idx+1) % array.length] array end names_n_colors(people, colors) end