Published
Edited
Apr 10, 2020
Insert cell
Insert cell
size = 16
Insert cell
blank = {
let c = document.createElement('canvas')
c.width = size
c.height = size
let cx = c.getContext('2d')
cx.fillRect(0,0,size,size)
return c
}
Insert cell
blank_size = blank.toDataURL().length
Insert cell
noise = {
let cc = document.createElement('canvas')
cc.width = size
cc.height = size
let ccx = cc.getContext('2d')
for (let r=0; r<size;r++) {
for (let c=0; c<size;c++) {
let rgb = [...Array(3)].map(n => Math.floor(Math.random() * 256)).join(',')
ccx.fillStyle = 'rgb(' + rgb + ')'
ccx.fillRect(c, r, 1, 1)
}
}
return cc
}
Insert cell
noise_size = noise.toDataURL().length
Insert cell
md`so 130 to 1366. ${(1366-130)/2} midpont: ${(1366-130)/2 + 130}`
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.
Learn more