Platform
Resources
Pricing
Sign in
Contact us
sw1227
Vis / Geo / Generative / Simulation / AI / Math 🥑 Portfolio: https://sw1227.github.io/portfolio
Workspace
Fork
Published
Generative
By
sw1227
Edited
Mar 8, 2020
1 fork
2 stars
Insert cell
Insert cell
createREGL
=
require
(
'https://unpkg.com/regl@1.3.1/dist/regl.min.js'
)
Insert cell
function
createGL
(
opts
)
{
var
canvas
=
html
`<canvas width="960" height="600">`
var
regl
=
createREGL
(
Object
.
assign
(
{
canvas
:
canvas
}
,
opts
||
{
}
)
)
return
{
canvas
,
regl
}
}
Insert cell
gl
=
createGL
(
)
Insert cell
Insert cell
Insert cell
Insert cell
cmd
=
gl
.
regl
(
{
vert
:
vertexShader
,
frag
:
fragmentShader
,
attributes
:
{
a_vertex
:
[
[
-
1
,
-
1
]
,
[
+
1
,
-
1
]
,
[
+
1
,
+
1
]
,
[
-
1
,
+
1
]
]
,
}
,
uniforms
:
{
u_size
:
gl
.
canvas
.
width
,
u_time
:
gl
.
regl
.
prop
(
"u_time"
)
}
,
primitive
:
"triangle fan"
,
count
:
4
}
)
Insert cell
function
draw
(
t
)
{
gl
.
regl
.
clear
(
{
color
:
[
0
,
0
,
0
,
1
]
}
)
cmd
(
{
u_time
:
t
}
)
}
Insert cell
draw
(
(
now
%
100000
)
/
1000
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
createREGL
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
createGL
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
gl
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
fragmentShader
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
vertexShader
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
cmd
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
draw
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML