Platform
Solutions
Resources
Pricing
Sign in
Sign up
Brett Cooper
In New Zealand being kid of human. We might make mistakes but we will make other things too. - Michael Joseph Savage
Workspace
Fork
Public
By
Brett Cooper
Edited
Jan 29, 2023
Fork of
Precessing "小宇宙" by "ayametakuya"
Importers
Insert cell
Insert cell
Insert cell
function
noise
(
a
,
b
,
c
)
{
switch
(
arguments
.
length
)
{
case
0
:
return
(
simplex
.
noise2D
(
0
,
0
)
+
1
)
/
2
break
;
case
1
:
return
(
simplex
.
noise2D
(
a
,
0
)
+
1
)
/
2
break
;
case
2
:
return
(
simplex
.
noise2D
(
a
,
b
)
+
1
)
/
2
break
;
default
:
return
(
simplex
.
noise3D
(
a
,
b
,
c
)
+
1
)
/
2
}
}
Insert cell
simplex
=
new
simplexNoise
(
42
)
Insert cell
simplexNoise
=
require
(
'simplex-noise@2.4.0'
)
Insert cell
Insert cell
function
random
(
max
)
{
return
~
~
(
Math
.
random
(
)
*
max
)
;
}
Insert cell
---
##
A function to emulate P5.js map() function using D3
Insert cell
function
map
(
value
,
start1
,
stop1
,
start2
,
stop2
)
{
return
d3
.
scaleLinear
(
)
.
domain
(
[
start1
,
stop1
]
)
.
range
(
[
start2
,
stop2
]
)
(
value
)
}
Insert cell
function
bool
(
)
{
return
Math
.
random
(
)
>
0.5
;
// random bool
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import
{
Vector
}
from
"@esperanc/2d-geometry-utils"
Insert cell
a
=
new
Vector
(
10
,
20
)
Insert cell
b
=
new
Vector
(
1
,
20
)
Insert cell
a
.
add
(
b
)
Insert cell
Insert cell
PI
=
Math
.
PI
Insert cell
TAU
=
PI
*
2
Insert cell
Insert cell
function
recursiveRandom
(
count
)
{
let
n
=
1
;
while
(
count
>
0
)
{
n
*=
Math
.
random
(
)
;
count
--
;
}
return
n
}
Insert cell
One platform
to build and deploy the best data apps
Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
noise
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
simplex
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
simplexNoise
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
random
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
map
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
bool
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
a
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
b
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
PI
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
TAU
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
recursiveRandom
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML