Skip to content

Instantly share code, notes, and snippets.

@monkstone
Created August 27, 2021 07:23
Show Gist options
  • Save monkstone/8ea901194bd230e18f21500789ee0bf6 to your computer and use it in GitHub Desktop.
Save monkstone/8ea901194bd230e18f21500789ee0bf6 to your computer and use it in GitHub Desktop.
uniform_noise

UniformNoise by micycle

See source code You will need maven to build (no other dependencies)

require 'picrate'
class UniformNoiseTest < Processing::App
load_library :uniform_noise
java_import 'micycle.uniformnoise.UniformNoise'
java_import 'java.awt.Color'
OCTAVES = 4
def setup
sketch_title 'Uniform Noise Test'
load_pixels
@unoise = UniformNoise.new
end
def draw
grid(width, height) do |x, y|
val = if x < width / 2
(SmoothNoise.noise(x * 0.015, y * 0.015, frame_count * 0.035) + 1) / 2
else
@unoise.uniform_noise(x * 0.0085, y * 0.0085, frame_count * 0.01, OCTAVES, 0.5)
end
pixels[y * width + x] = Color.HSBtoRGB(val, 1, 1)
end
update_pixels
end
def settings
size(800, 800, P2D)
end
end
UniformNoiseTest.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment