Skip to content

Commit 5c130e8

Browse files
author
monkstone
committed
update jwishy for pry usage
1 parent afe2410 commit 5c130e8

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

samples/contributed/jwishy.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
load_library :control_panel
1515

16-
attr_accessor :x_wiggle, :y_wiggle, :magnitude, :bluish, :panel, :laf, :hide
16+
attr_reader :alpha, :back_color, :bluish, :hide, :magnitude, :panel
17+
attr_reader :x_wiggle, :y_wiggle
1718

1819
def setup
1920
size 600, 600
@@ -31,20 +32,15 @@ def setup
3132
@alpha, @bluish = 0.5, 0.5
3233
@x_wiggle, @y_wiggle = 10.0, 0
3334
@magnitude = 8.15
34-
@background = [0.06, 0.03, 0.18]
35+
@back_color = [0.06, 0.03, 0.18]
3536
color_mode RGB, 1
3637
ellipse_mode CORNER
3738
smooth
3839
end
3940

40-
def background=(*args)
41-
@background = args.flatten
42-
end
43-
44-
4541
def draw_background
46-
@background[3] = @alpha
47-
fill(*@background) if @background[0]
42+
back_color[3] = alpha
43+
fill(*back_color.to_java(:float)) if back_color[0]
4844
rect 0, 0, width, height
4945
end
5046

@@ -62,7 +58,7 @@ def draw
6258

6359
# Seed the random numbers for consistent placement from frame to frame
6460
srand(0)
65-
horiz, vert, mag = @x_wiggle, @y_wiggle, @magnitude
61+
horiz, vert, mag = x_wiggle, y_wiggle, magnitude
6662

6763
if @go_big
6864
mag *= 2
@@ -76,7 +72,7 @@ def draw
7672
64.times do
7773
x += cos(horiz) * mag
7874
y += log10(vert) * mag + sin(vert) * 2
79-
fill(sin(@y_wiggle + c), rand * 0.2, rand * blu, 0.5)
75+
fill(sin(y_wiggle + c), rand * 0.2, rand * blu, 0.5)
8076
s = 42 + cos(vert) * 17
8177
args = [x - s / 2, y - s / 2, s, s]
8278
@shape == 'oval' ? oval(*args) : rect(*args)

0 commit comments

Comments
 (0)