Herteby/simplex-noise

Generate simplex noise (an improvement of Perlin noise)


License
MIT
Install
elm-package install Herteby/simplex-noise 1.2.2

Documentation

Simplex-noise

This is a library to generate simplex noise in Elm.

Interactive demo

simplex

Example usage

import Simplex exposing (PermutationTable)

--Create a permutation table, using 42 as the seed
permTable : PermutationTable
permTable =
    Simplex.permutationTableFromInt 42

-- Create a function for 2D fractal noise
noise : Float -> Float -> Float
noise =
    Simplex.fractal2d { scale = 4.0, steps = 7, stepSize = 2.0, persistence = 2.0 } permTable

-- Create a 100x100 matrix of fractal noise. 
image : List (List Float)
image =
    List.range 0 99
        |> List.map
            (\x ->
                List.range 0 99
                    |> List.map
                        (\y ->
                            noise (toFloat x) (toFloat y)
                        )
            )


Original version written by Andreas Köberle, who ported the simplex-noise.js library written by by Jonas Wagner.