Giter VIP home page Giter VIP logo

three-noise's Introduction


THREE-Noise

Simple gradient noise library for use with Three.js. Now with fBm!
View Demo · Report Bug · API Docs

Installation

Make sure to have ThreeJS installed.

$ npm i three

Install through NPM

$ npm i three-noise

For Browsers, download build/three-noise.js.

Importing

Browser

In your HTML

<script src="lib/three-noise.js"></script>
<script src="./main.js" defer></script>

Then, in your JavaScript you can use the THREE_Noise object.

const { Perlin, FBM } = THREE_Noise;

NodeJS

In NodeJS, you can import it like you normally do.

import { Perlin, FBM } from 'THREE_Noise';

Usage

Perlin

// Instantiate the class with a seed
const perlin = new Perlin(Math.random())

perlin.get2(vector2)   // Get 2D Perlin Nosie
perlin.get3(vector3)   // Get 3D Perlin Nosie

fBm

// Instantiate the class with a seed
const fbm = new FBM({
    seed: Math.random()
})

fbm.get(vector2)      // Get 2D Perlin Nosie with fBm
fbm.get(vector3)      // Get 3D Perlin Nosie with fBm

three-noise's People

Contributors

farazzshaikh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

three-noise's Issues

Using this in a THREE.js project ' Multiple instances of Three.js being imported.'

Hello,

I am trying to use this library in an existing three.js project, having installed it via npm, and included it in my code,

I am getting a WARNING: Multiple instances of Three.js being imported.

Checking the three-noise module files, i waw that this library also imports threejs within it. Will this be an issue in regards to duplication of library imports?

Use three as a peerDependency instead of dependency

This would allow the users to choose their version of three instead of imposing yours.

And in many cases, this would avoid to download (and execute) two versions of three (since it is in 0.x version, the caret ^ matches only patch versions so ^0.128.0 will likely be different from the user's version)

WYT ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.