Published
Edited
Dec 17, 2020
2 stars
Insert cell
bnb({
w: 500,
h: 500,
webgl: true,
numFrames: 60,
fps: 30,
preview: 10,
shutterAngle: .3,
samplesPerFrame: 8,
record: true,
globals: {
l: 1400,
w: 2000,
s: 5,
lineStep: 5,
scale: 150,
h: 200,
noiseRadius: 1,
noiseTrail: TAU * .7
},
draw: (s, t, g) => {
// s.ortho(-s.width / 2, s.width / 2, s.height / 2, -s.height / 2, -500, 1000)
s.perspective(s.PI/3.0, s.width/s.height, 0, 4000)
s.camera(0, -150, 400, 0, 0, 0, 0, 1, 0)
s.background(22)
s.translate(50, 0, 0)
s.rotateY(-s.PI/8)
s.translate(s.random(-.5, .5), s.random(-.5, .5))

s.strokeWeight(2)
s.fill(22)
s.noStroke()
const tAngle = -t * TAU
const cosT = s.cos(tAngle) * 0
const sinT = s.sin(tAngle) * 0
for(let z = -g.w / 2; z < g.w / 2; z += g.s) {
const angle1 = tAngle + s.map(z, -g.w/2, g.w / 2, 0, g.noiseTrail)
const sin1 = s.sin(angle1) * g.noiseRadius
const cos1 = s.cos(angle1) * g.noiseRadius
const z2 = z + g.s
const angle2 = tAngle + s.map(z2, -g.w/2, g.w / 2, 0, g.noiseTrail)
const sin2 = s.sin(angle2) * g.noiseRadius
const cos2 = s.cos(angle2) * g.noiseRadius
for(let x = -g.l / 2; x < g.l / 2; x += g.s) {
const x2 = x + g.s
s.beginShape()
s.vertex(x, (simplex.noise3D(seed + x / g.scale, sin1 + cosT, cos1 + sinT) / 2 + .5) * g.h - g.h / 2, z)
s.vertex(x2, (simplex.noise3D(seed + x2 / g.scale, sin1 + cosT, cos1 + sinT) / 2 + .5) * g.h - g.h / 2, z)
s.vertex(x2, (simplex.noise3D(seed + x2 / g.scale, sin2 + cosT, cos2 + sinT) / 2 + .5) * g.h - g.h / 2, z2)
s.vertex(x, (simplex.noise3D(seed + x / g.scale, sin2 + cosT, cos2 + sinT) / 2 + .5) * g.h - g.h / 2, z2)
s.endShape(s.CLOSE)
}
}

s.fill(0, 0)
s.noFill()
s.stroke(255)
for(let x = -g.l / 2; x <= g.l / 2; x += g.s * g.lineStep) {
s.beginShape()
s.vertex(x, 1000, -g.w / 2)
for(let z = -g.w / 2; z <= g.w / 2; z += g.s) {
const angle1 = tAngle + s.map(z, -g.w/2, g.w / 2, 0, g.noiseTrail)
const sin1 = s.sin(angle1) * g.noiseRadius
const cos1 = s.cos(angle1) * g.noiseRadius
s.vertex(x, (simplex.noise3D(seed + x / g.scale, sin1 + cosT, cos1 + sinT) / 2 + .5) * g.h - g.h / 2 - 1, z)
}
s.vertex(x, 1000, g.w / 2)
s.endShape()
}
for(let z = -g.w / 2; z <= g.w / 2; z += g.s * g.lineStep) {
const angle1 = tAngle + s.map(z, -g.w/2, g.w / 2, 0, g.noiseTrail)
const sin1 = s.sin(angle1) * g.noiseRadius
const cos1 = s.cos(angle1) * g.noiseRadius
s.beginShape()
s.vertex(-g.l / 2, 1000, z)
for(let x = -g.l / 2; x <= g.l / 2; x += g.s) {
s.vertex(x, (simplex.noise3D(seed + x / g.scale, sin1 + cosT, cos1 + sinT) / 2 + .5) * g.h - g.h / 2 - 1, z)
}
s.vertex(g.l / 2, 1000, z)
s.endShape()
}
},
})
Insert cell
seed = Date.now()
Insert cell
Insert cell
import {simplex, TAU} from '@makio135/utilities'
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