File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
external_library/gem/toxiclibs/noise Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change 33# by Martin Prout.
44# Using noise to create simple texture.
55# control parameter with mouse
6+ DELTA = 0.02
67
78def setup
89 sketch_title 'Noisy Texture'
9- @increment = 0.02
1010end
1111
1212def draw
1313 background 0
1414 load_pixels
15- xoff = 0.0
16- x_val = map1d ( mouse_x , 0 ..width , 1 ..100 )
17- ( 0 ...width ) . each do |x |
18- xoff += @increment
19- yoff = 0.0
20- ( 0 ...height ) . each do |y |
21- yoff += @increment
22- bright = Toxi ::SimplexNoise . noise ( x / x_val , y / x_val ) * 255
23- pixels [ x + y * width ] = color ( bright )
24- end
15+ x_val = map1d ( mouse_x , 0 ..width , 1 ..10 )
16+ grid ( width , height ) do |x , y |
17+ bright = (
18+ Toxi ::SimplexNoise . noise ( x * DELTA / x_val , y * DELTA / x_val ) + 1
19+ ) * 128
20+ pixels [ x + y * width ] = color ( bright )
2521 end
2622 update_pixels
2723end
You can’t perform that action at this time.
0 commit comments