Skip to content

Commit dffed4c

Browse files
committed
more mods
1 parent 7438428 commit dffed4c

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

external_library/gem/toxiclibs/noise/simplex_noise_texture.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,21 @@
33
# by Martin Prout.
44
# Using noise to create simple texture.
55
# control parameter with mouse
6+
DELTA = 0.02
67

78
def setup
89
sketch_title 'Noisy Texture'
9-
@increment = 0.02
1010
end
1111

1212
def 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
2723
end

0 commit comments

Comments
 (0)