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

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.
Learn more