Sha256: 452881e661d9c7346b5e522fd70cd652f241fde0424f0cd72426cfbb1150fb4a
Contents?: true
Size: 1.41 KB
Versions: 3
Compression:
Stored size: 1.41 KB
Contents
--- layout: post title: "Noise Modes" --- ### Name ### There are two noise modes available in PiCrate, both base on KdotJPG java noise. The default noise uses the FastNoise module, the SmoothNoise module can be used using the module name as a prefix see example below. ### Examples ### ```ruby #!/usr/bin/env jruby -w require 'picrate' class TestNoise < Processing::App attr_reader :z def setup stroke(255, 64) @z = 0 end def draw noise_scale = 0.01 background(0) grid(width, height, 10, 10) do |x, y| arrow(x, y, SmoothNoise.noise(x * noise_scale, y * noise_scale, z * noise_scale) * TWO_PI * 2) # arrow(x, y, noise(x * noise_scale, y * noise_scale, z * noise_scale) * TWO_PI * 2) end @z += 1 end def arrow(x, y, ang) push_matrix() translate(x, y) rotate(ang) line(0, 0, 20, 0) translate(20, 0) rotate(PI + 0.4) line(0, 0, 5, 0) rotate(-0.8) line(0, 0, 5, 0) pop_matrix() end def settings size(600, 400, P2D) end end TestNoise.new ``` ### Description ### Currently supports four implementations of noise:- 1. Default is classic OpenSimplex2 2. SmoothNoise use smoother class OpenSimplex2F 3. Use tnoise instead of noise for a noise mode more suited to terrain ### Syntax ### ```ruby SmoothNoise.noise(...) # no prefix for fast classic OpenSimplex2 ``` ### Related ### `noise(x, y, z, w)` `noise(x, y, z)` `noise(x, y)`
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
picrate-2.5.2-java | docs/_methods/noise_modes.md |
picrate-2.5.1-java | docs/_methods/noise_modes.md |
picrate-2.5.0-java | docs/_methods/noise_modes.md |