Published
Edited
Jun 1, 2020
Fork of Absorption
1 fork
Insert cell
md`# Reflection`
Insert cell
Insert cell
height = 400
Insert cell
seedrandom = require("seedrandom@3/seedrandom.min.js")
Insert cell
reflect = {
var svg = d3.select(DOM.svg(width, height))
.attr("width", width+"px")
.attr("height", height+"px");
var filter = svg.append("defs")
.append("filter")
.attr("id", "blur")
.append("feGaussianBlur")
.attr("stdDeviation", 5);
/* svg.append("line")
.attr("x1", 0)
.attr("x2", width)
.attr("y1", height/2)
.attr("y2", height/2)
.style("stroke","black")
.style("stroke-width","2px")
*/
function createCircle() {
const pt1 = d3.randomUniform (0, 400)()
const pt2 = d3.randomUniform (0, 400)()
svg.select("circle").remove()
svg.append("circle")
.attr("fill", "#dfeb34")
.attr("cx",pt1)
.attr("cy",-100)
.attr("r", 10)
.transition()
.duration(500)
.attr("cx",pt2)
.attr("cy",height/2+-10)
.transition()
.duration(500)
.attr("cx", 2*pt2-pt1)
.attr("cy", -100)
.attr("filter", "url(#blur)");
d3.selectAll(".class-of-elements")
.style("filter", "url(#glow)");
svg.append("rect")
.attr("x", 0)
.attr("y", height/2)
.attr("width", width)
.attr("height", height)
.style("fill", "#222222")
}
createCircle()
new Promise((resolve, reject) => {
setInterval(() => {
createCircle()
}, 1200);


})
return svg.node();
}
Insert cell
Insert cell
d3 = require("d3@5")
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more