UNPKG
tumult
Version:
latest (3.0.14)
3.0.14
3.0.13
3.0.12
3.0.11
3.0.10
3.0.9
3.0.7
3.0.5
3.0.4
3.0.3
3.0.2
3.0.1
3.0.0
2.0.0
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
A Javascript noise library
github.com/ScottyFillups/tumult
ScottyFillups/tumult
tumult
/
lib
/
util
/
1d.js
22 lines
(16 loc)
•
236 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict'
class
Vec1
{
constructor
(
x
) {
this
.
x
= x }
dot
(x) {
return
this
.
x
* x } }
const
g1 = [
new
Vec1
(
1
),
new
Vec1
(-
1
) ]
function
grad1
(
p, x
) {
return
g1[p[x] % g1.
length
] }
module
.
exports
= { grad1 }