Platform
Resources
Pricing
Sign in
Get started
Ian Johnson
pixel flipper, data sifter. trying to see what I can while I'm here
Workspace
Fork
Published
QuickDraw
By
Ian Johnson
Edited
Jan 20, 2020
Fork of
Pigs
4 stars
Insert cell
Insert cell
Insert cell
camera
=
{
var
camera
=
createReglCamera
(
regl
,
{
phi
:
90
,
// theta: 1,
distance
:
10
,
center
:
[
0.5
,
0.5
,
0
]
,
rotationCenter
:
[
0.5
,
0.5
,
0
]
,
}
)
;
createInteractions
(
camera
)
;
return
camera
;
}
Insert cell
model
=
mat4create
(
)
;
Insert cell
Insert cell
Insert cell
drawings
=
chosen
.
map
(
(
d
)
=>
{
return
process
(
d
,
{
x
:
Math
.
random
(
)
,
y
:
Math
.
random
(
)
,
z
:
Math
.
random
(
)
}
)
}
)
Insert cell
Insert cell
Insert cell
{
tick
;
camera
(
(
state
)
=>
{
// regl.poll();
if
(
!
state
.
dirty
)
return
;
regl
.
clear
(
{
color
:
[
0.05
,
.05
,
0.05
,
1
]
}
)
;
drawings
.
slice
(
0
,
50
)
.
forEach
(
(
d
)
=>
{
draw3d
(
d
,
state
)
}
)
}
)
yield
;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// viewof bigindex = html`<input type=range min=0 max=${chosen.length-1} step=1 value=17>`
Insert cell
// md`Rendering drawing #${bigindex}. Some of my favorites are 17, 53, 64, 74, 76, 77`
Insert cell
//md`Thickness of the line used to draw the large pig: ${thickness}px`
Insert cell
// viewof thickness = html`<input type=range min=1 max=50 step=1>`
Insert cell
/*
viewof colored = {
var w = width
var h = height
var el = DOM.canvas(w,h)
var ctx = el.getContext("2d")
var line = d3.line()
.x(function(d) { return d.x * 2 })
.y(function(d) { return d.y * 2 })
.curve(d3.curveBasis)
.context(ctx) // <-- so convenient!
// render the large pig
ctx.lineCap = "round"
big.strokes.forEach(function(s) {
// ctx.strokeStyle = "#ccc"
ctx.strokeStyle = "rgba(200,200,200,0.75)"
ctx.lineWidth = thickness
ctx.beginPath()
line(s)
ctx.stroke()
})
return el
}
*/
Insert cell
// big = {
// let w = width/2
// let h = height/2
// let stroked = strokifyDrawing(chosen[bigindex])
// stroked.strokes = center(stroked.strokes, w,h,h/300)
// stroked.points = stroked.strokes.map(function(stroke) {
// return stroke.map(function(d) { return [d.x/300, 0, d.y/300] })
// })
// return stroked
// }
Insert cell
// rounded = interleavedStripRoundCapJoin(regl, 10)
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
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
regl
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
camera
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
model
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
interactions
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
tick
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
drawings
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
process
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
draw3d
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
height
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
rounded3d
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
projection
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
drawStroke
Edit
Add comment
Copy import
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
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
glLineStrip
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
segmentInstanceGeometry
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
interleavedSegments
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
interleavedStrip
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
interleavedStripRoundCapJoin3D
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
interleavedStripRoundCapJoin
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
roundCapJoinGeometry
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
circleGeometry
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
roundJoin
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
roundCap
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
sets
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
datas
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
chosen
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
strokifyDrawing
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
center
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
svg
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML