Published
Edited
May 9, 2020
1 fork
4 stars
Insert cell
Insert cell
Insert cell
bnb({
draw: (s, t, g) => {
const scalar_field_offset = (x, y) => {
const distance = s.dist(x, y, s.width / 2, s.height / 2)
const perlin_noise_intensity = ease(s.constrain(s.map(distance, 0, 0.7 * s.height, 1, 0), 0, 1), 2)

const scale = 0.012
const result = - 0.01 * (y + x) + 30 * (s.noise(scale * x, scale * y) - 0.5) * perlin_noise_intensity
return result
}

const pixel_color = (x, y, t) => {
const result = ease(s.map(s.sin(s.TWO_PI * (t + scalar_field_offset(x, y))), -1, 1, 0, 1), 3)
return scales.viridis(result)
}

for(let i = 0; i < s.width; i++) {
for(let j = 0; j < s.height; j++) {
s.stroke(pixel_color(i, j, t))
s.point(i, j)
}
}
},
numFrames: 20,
w: 540,
h: 540,
record: true,
gifDelay: 30,
shutterAngle: 0,
samplesPerFrame: 1,
chromaticAberration: 2.5,
})
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