Search Unity

Free Perlin noise in TypeScript

Discussion in 'Project Tiny' started by vincismurf, Dec 18, 2018.

  1. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
    So I ported this Perlin Noise over to Typescript, I needed it for my project,. . . consider it a Christmas Present

    Just to note unlike the built-in C# PerlinNoise Method which gives you a value 0-1 this gives -1 to 1. . . . remap accordingly.

    From:
    https://github.com/josephg/noisejs
    By:
    Stefan Gustavson's implementation.


    Use as such:
    Code (JavaScript):
    1. game.Perlin.Init();
    2. game.Perlin.seed(Math.random());
    3. game.Perlin.perlin2(x, seed);

    Note one value needs to be between 0-1


    If anyone knows a better way to initialize the class please let me know.
     

    Attached Files:

    ER_Dolleman and Raspilicious like this.
  2. Raspilicious

    Raspilicious

    Joined:
    Jun 21, 2012
    Posts:
    24
    Thanks, vincismurf, that's very handy!
     
unityunity