File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed
Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ def setup
1717 background ( 0 )
1818 stroke ( 255 )
1919 fill ( 32 , 255 , 64 )
20- noise_mode ( Propane ::SIMPLEX )
2120 @half_w = width * 0.5
2221 @half_h = height * 0.5
2322 @radius = height * 0.4
Original file line number Diff line number Diff line change 1+ require 'propane'
2+ # OpenSimplex has a range -1.0 to 1.0
3+ class NoiseImage < Propane ::App
4+ SCALE = 0.02
5+
6+ def setup
7+ sketch_title 'Noise Image'
8+ background ( 0 )
9+ stroke ( 255 )
10+ no_fill
11+ end
12+
13+ def draw
14+ background ( 0 )
15+ scale = 0.02
16+ load_pixels
17+ grid ( 500 , 500 ) do |x , y |
18+ col = noise ( SCALE * x , SCALE * y ) > 0 ? 255 : 0
19+ pixels [ x + width * y ] = color ( col , 0 , 0 )
20+ end
21+ update_pixels
22+ save ( data_path ( 'noise_image.png' ) )
23+ end
24+
25+ def settings
26+ size 500 , 500
27+ end
28+ end
29+
30+ NoiseImage . new
You can’t perform that action at this time.
0 commit comments