File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed
Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -15,20 +15,19 @@ def setup
1515 size 450 , 320
1616 @hide = false
1717 control_panel do |c |
18- c . title = " controller"
18+ c . title = ' controller'
1919 c . menu ( :detail , %w( 4 5 6 7 8 9 10 ) , '7' )
2020 c . button :toggle_debug
2121 c . button :save_image
2222 @panel = c
2323 end
24-
2524 @debug = false
2625 @save_one = false
2726 smooth 8
2827end
2928
3029def draw
31- if ( ! hide )
30+ unless hide
3231 panel . set_visible true
3332 @hide = true
3433 end
@@ -47,20 +46,17 @@ def draw
4746 end
4847 end
4948 end_shape ( CLOSE )
50-
51- if ( debug )
49+ if debug
5250 # draw lines between points
5351 stroke_weight ( 1 )
5452 no_fill
5553 stroke ( 0 )
56-
5754 begin_shape
5855 detail . to_i . times do |i |
5956 vertex cos_cx ( i ) , sin_cy ( i ) unless i == 0
6057 vertex cos_x ( i ) , sin_y ( i )
6158 end
6259 end_shape CLOSE
63-
6460 # draw points
6561 stroke_weight 8
6662 detail . to_i . times do |i |
@@ -70,11 +66,9 @@ def draw
7066 point cos_cx ( i ) , sin_cy ( i )
7167 end
7268 end
73-
74- if save_one
75- save_frame ( "images/quadraticvertex-#####.png" )
76- @save_one = false
77- end
69+ return unless save_one
70+ save_frame ( 'images/quadraticvertex-#####.png' )
71+ @save_one = false
7872end
7973
8074def mouse_pressed
@@ -90,11 +84,11 @@ def sin_y(n)
9084end
9185
9286def cos_cx ( n )
93- cos ( step_angle * n - ( step_angle / 2 ) ) * cr
87+ cos ( step_angle * n - ( step_angle / 2 ) ) * cr
9488end
9589
9690def sin_cy ( n )
97- sin ( step_angle * n - ( step_angle / 2 ) ) * cr
91+ sin ( step_angle * n - ( step_angle / 2 ) ) * cr
9892end
9993
10094def toggle_debug
You can’t perform that action at this time.
0 commit comments