Skip to content

ch3mbot/pxt-noise

Repository files navigation

Open this page at https://ch3mbot.github.io/pxt-noise/

Description

This extension adds several noise generators. Currently only javascript is supported.

Noise Generators

1D

  • 1D Perlin noise
  • 1D Perlin noise with hash function

2D

  • 2D Perlin noise
  • 2D Perlin noise with hash function
  • 2D open simplex noise

Use as Extension

This repository can be added as an extension in MakeCode.

Usage Examples

How to initialize a noise generator and sample it:

let generator = new noise.OpenSimplexNoise2D();
let value = generator.noise(x, y);

The default seed is 0. When seed is set to 0 the default permutation table is used.

How to initialize a noise generator with a seed:

let generator = new noise.PerlinNoise1D(12345);


The perlin noise generators can optionally be given an interpolation function:

let generator = new noise.PerlinNoise2D(0, noise.interpolate2DQuint);

The default interpolation function is cubic interpolation. Quintic is slower but smoother, while linear is fast but jagged.

Edit this project

To edit this repository in MakeCode.

TODO

  • 3D noise
  • 4D noise?
  • Test 1D Perlin noise with hash function
  • 2D worley noise

Metadata (used for search, rendering)

  • for PXT/arcade
<script src="https://makecode.com/gh-pages-embed.js"></script><script>makeCodeRender("{{ site.makecode.home_url }}", "{{ site.github.owner_name }}/{{ site.github.repository_name }}");</script>

About

A MakeCode project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors