Public
Edited
Mar 19, 2021
1 fork
67 stars
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
sr = s/2 // small hole radius
Insert cell
lr = l/2 // large hole diameter
Insert cell
rd = lr - sr // radius diff
Insert cell
h = th+l+th // height of o/x/etc
Insert cell
sa = slant * (Math.PI/180)
Insert cell
// slant: adjacent len to hypothenuse len
function s_a2h(w, m = 1) {
return w / Math.cos(m * slant * (Math.PI/180));
}
Insert cell
// slant: adjacent len to opposite len
function s_a2o(h, m = 1) {
return h * Math.tan(m * slant * (Math.PI/180));
}
Insert cell
// slanted stroke's top width (if vertical) or side height (if horizontal)
sth = s_a2h(th)
Insert cell
colors = ({
blue: "#00B3E3",
pink: "#DA3AB3",
red: "#FF4338",
orange: "#FF6B00",
green: "#05CE7C",
yellow: "#FFC843",
background: "#f6f3f2",
})
Insert cell
Insert cell
Insert cell
Insert cell
function inputsGroup(views) {
const form = html`<div style="display: flex; flex-wrap: wrap; margin: 0 -8px;">
${Object.entries(views).map(([name, view]) => {
return html`<div style="padding: 8px;">${view}</div>`;
})}
</div>`;

form.oninput = () => {
form.value = Object.entries(views).reduce((value, [name, view]) => {
value[name] = view.value;
return value;
}, {});
};
form.oninput();
return form;
}
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