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 fieldsgabor: Gabor noise for procedural textures and patternswhite: White noise and pseudo-random number generationsinusoid: Sinusoidal noise patternsimg_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 multiplierRe-exports§
Modules§
Structs§
- Noise
Opts - 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].