Published
Edited
May 9, 2018
10 stars
Insert cell
Insert cell
Insert cell
angle
Insert cell
viewof angle = {
const form = html`<form><input name=velocity type=range value=0.001 min=-0.01 max=0.01 step=any>`;

// Update the value every animation frame.
let then = 0, frame = requestAnimationFrame(function loop(now) {
form.value += (now - then) * form.velocity.valueAsNumber;
form.dispatchEvent(new CustomEvent("input"));
then = now, frame = requestAnimationFrame(loop);
});

// Break the loop on invalidation.
invalidation.then(() => cancelAnimationFrame(frame));

// Set the initial value.
form.value = 0;
return form;
}
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