Published
Edited
Jun 10, 2019
Importers
12 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function noise(row, column, [x, y, z]) {
const n = fbm(octaves);
const t = Math.abs(Math.cos(row * 7.5 / width + n(x, y, z)));
return color(t).rgb();
//return n(x * 8, y * 8, z * 8);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
imageData = {
const data = new Uint8ClampedArray(width * height * 4);

for (let row = 0; row < height; row++) {
for (let column = 0; column < width; column++) {
const [r, g, b] = noise(row, column, getSphereCoordinates(column / (width - 1), row / (height - 1)));
const index = (column + row * width) * 4;
data[index ] = r;
data[index + 1] = g;
data[index + 2] = b;
data[index + 3] = 255;
}
}
return data;
}
Insert cell
function getSphereCoordinates(u, v) {
const lon = (u * 360 - 180) * Math.PI / 180,
lat = (v * 180 - 90) * Math.PI / 180;

return [
(Math.cos(lat) * Math.cos(lon) + 1) / 2,
(Math.sin(lat) + 1) / 2,
(Math.cos(lat) * Math.sin(lon) + 1) / 2
]
}
Insert cell
color = chroma.scale(colors).mode("lab")
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

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