Skip to main content

Crate wassily_noise

Crate wassily_noise 

Source
Expand description

§Wassily Noise

Noise generation utilities optimized for generative art applications. This crate provides ergonomic wrappers around the Rust noise library with f32 support, additional noise functions, and utilities specifically designed for creative coding and generative art.

§Key Features

  • f32 Support: All noise functions work with f32 instead of f64 for better performance
  • Scale-Independent: Noise scaling that adapts to canvas size automatically
  • Generative Art Focus: Additional noise types specifically useful for creative coding
  • Easy Integration: Seamless integration with wassily’s canvas and shape systems

§Available Noise Types

  • Core Functions: noise2d(), noise3d() with normalized variants
  • curl: Curl noise for fluid-like effects and vector fields
  • gabor: Gabor noise for procedural textures and patterns
  • white: White noise and pseudo-random number generation
  • sinusoid: Sinusoidal noise patterns
  • img_noise: Image-based noise generation

§Quick Start

use wassily_noise::*;
use noise::{NoiseFn, Perlin};

// Create a noise function
let perlin = Perlin::new(42);
let opts = NoiseOpts::default().scales(0.01);

// Generate noise values
let value = noise2d(perlin, &opts, 100.0, 150.0);      // Range: [-1, 1]
let normalized = noise2d_01(perlin, &opts, 100.0, 150.0); // Range: [0, 1]

§Noise Options

The NoiseOpts struct provides fine-grained control over noise generation:

use wassily_noise::*;

let opts = NoiseOpts::default()
    .width(800.0)
    .height(600.0)
    .scales(0.005)        // Uniform scaling
    .factor(2.0);         // Amplitude multiplier

Re-exports§

pub use curl::*;
pub use gabor::*;
pub use img_noise::*;
pub use sinusoid::*;
pub use white::*;

Modules§

curl
Curl Noise
gabor
Gabor Noise
img_noise
sinusoid
Various sinusoidal noises.
white
White Noise

Structs§

NoiseOpts
Configuration options for noise generation.

Functions§

noise2d
Get a f32 noise value in the range [-1.0, 1.0].
noise2d_01
Get a f32 noise value in the range [0.0, 1.0].
noise3d
Get a f32 noise value in the range [-1.0, 1.0].
noise3d_01
Get a f32 noise value in the range [0.0, 1.0].