Skip to content

Commit

Permalink
Fix negative index error
Browse files Browse the repository at this point in the history
  • Loading branch information
williamngan committed Aug 13, 2018
1 parent 5be8f59 commit 09c6378
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ export class Noise extends Pt {
*/
noise2D() {

let i = Math.floor( this._n[0] ) % 255;
let j = Math.floor( this._n[1] ) % 255;
let i = Math.max(0, Math.floor( this._n[0] )) % 255;
let j = Math.max(0, Math.floor( this._n[1] )) % 255;
let x = (this._n[0] % 255) - i;
let y = (this._n[1] % 255) - j;

Expand Down

0 comments on commit 09c6378

Please sign in to comment.