Published
Edited
Aug 12, 2018
3 forks
16 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// the angular step that corresponds to a line of stepWidth length in pixels
step = (t) => Math.atan(stepLength / radius(t))
Insert cell
// the maximum angle from the axis (after which the spiral certainly goes off the screen):
maxT = Math.log(Math.hypot(width / 2, height / 2) / a) / b
Insert cell
Insert cell
Insert cell
// radius of a logarithmic spiral (given an angle from the axis)
radius = (t) => a * Math.exp(b * t)
Insert cell
// position of a point on a spiral given an angle from the axis and an offset angle (for rotation)
pos = (t, angle) => {
const r = radius(t);
const x = r * Math.cos(t + angle);
const y = r * Math.sin(t + angle);
return {x, y};
}
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