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

outdated

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);
31
likes
0
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

License

unknown (LICENSE)

Dependencies

fixnum

More

Packages that depend on fast_noise