fast_noise 1.0.1 copy "fast_noise: ^1.0.1" to clipboard
fast_noise: ^1.0.1 copied to clipboard

A port of the fast noise algorithms, featuring cellular_noise, cubic_noise, perlin_noise, simplex_noise, value_noise and white_noise

example/example.dart

import 'dart:io';

import 'package:image/image.dart' as img;
import 'package:fast_noise/fast_noise.dart';

void main() {
  const w = 512, h = 512;
  final map = _getCellular(w, h);
  final image = img.Image.rgb(w, h);

  for (var x = 0; x < w; x++) {
    for (var y = 0; y < h; y++) {
      var value = (0x80 + 0x80 * map[x][y]).floor(); // grayscale

      image.setPixelRgba(x, y, value, value, value, 0xff);
    }
  }

  File('./example/noise.png').writeAsBytesSync(img.encodePng(image));
}

List<List<double>> _getCellular(int w, int h) => noise2(w, h,
    noiseType: NoiseType.Cellular,
    octaves: 5,
    frequency: 0.015,
    cellularDistanceFunction: CellularDistanceFunction.Euclidean,
    cellularReturnType: CellularReturnType.Distance2Add);
35
likes
135
pub points
84%
popularity

Publisher

verified publisherblue-fire.xyz

A port of the fast noise algorithms, featuring cellular_noise, cubic_noise, perlin_noise, simplex_noise, value_noise and white_noise

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

fixnum

More

Packages that depend on fast_noise