-1

I have to use a noise function from the library Noise.js. How would I go about adding the library to my file so that it is called?

Here is the small section that calls it.

//Use noise.js library to generate a grid of 2D simplex noise values
try {
  noise.seed(Math.random());
}
catch(err) {
  console.log(err.message);
}

Here is the link to the ThreeJS file that uses the noise function to create 3D curl noise. https://al-ro.github.io/projects/embers/embers.js

Here is the Noise library https://github.com/josephg/noisejs

Yerbs
  • 127
  • 1
  • 7
  • Did you have a look at the page source to see how the demo page was built? – Andy Oct 30 '22 at 13:15
  • I did, it links to just the source code for the JS file. Not the entire setup. Here is the link. https://al-ro.github.io/projects/embers/embers.js – Yerbs Oct 30 '22 at 13:22
  • @Yerbs What do you mean "the entire setup"? Are you not trying to import that same noise library? – Berthur Oct 31 '22 at 12:07

1 Answers1

0

Just do like in their example. Import the library using HTML <script> tags (before your own code), and then the object noise will be available to you as a global variable.

Berthur
  • 4,300
  • 2
  • 14
  • 28