Published
Edited
Aug 12, 2018
3 forks
16 stars
Also listed in…
Explorables
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

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