Published
Edited
Apr 14, 2018
Fork of Clock
Insert cell
Insert cell
{
const ms = now
const s = ~~(ms/1000) % 60
const m = (ms/60000) % 60
const h = (ms/3600000) % 24
return svg(face(50) + hand(h/12, 25, "black") + hand(m/60, 35, "blue") + hand(s/60, 45, "red"))
}
Insert cell
face = (r) => `<circle cx="50" cy="50" r="${r}" stroke="black" fill="none"/>`
Insert cell
hand = (v, r, col) => {
let a = v*Math.PI*2
let sa = Math.sin(a)
let ca = Math.cos(a)
let cx = 50
let cy = 50
return `<line x1="${cx}" y1="${cy}" x2="${cx + sa*r}" y2="${cy - ca*r}" stroke="${col}"/>`
}
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