Published
Edited
Mar 1, 2022
3 forks
44 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
emojis = Generators.observe(notify => {
const source = new EventSource("https://stream.emojitracker.com/subscribe/eps");
source.onmessage = message => notify(JSON.parse(message.data));
return () => source.close();
})
Insert cell
update = Object.keys(emojis).forEach(mode === "rain" ? rain : fade)
Insert cell
function rain(k) {
d3.select(svg)
.append("text")
.style("font", "25px sans-serif")
.attr("x", width * Math.random())
.attr("y", -10 - Math.random() * 300)
.attr("dy", "0.35em")
.attr("text-anchor", "middle")
.attr("fill", "black")
.attr("opacity", 1)
.text(String.fromCodePoint(parseInt(k, 16)))
.transition()
.duration(4000)
.ease(t => (t < .8 ? d3.easeBounce(t) : 0))
.attr("y", height - 10)
.remove();
}
Insert cell
function fade(k) {
d3.select(svg)
.append("text")
.style("font", "25px sans-serif")
.attr("x", width * Math.random())
.attr("y", height * Math.random())
.attr("dy", "0.35em")
.attr("text-anchor", "middle")
.attr("fill", "black")
.attr("opacity", 1)
.text(String.fromCodePoint(parseInt(k, 16)))
.transition()
.duration(5000)
.ease(d3.easeLinear)
.attr("opacity", 0)
.remove();
}
Insert cell
height = 500
Insert cell
import {radio} from "@jashkenas/inputs"
Insert cell
d3 = require('d3@5')
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