Published
Edited
Feb 14, 2020
1 star
Insert cell
Insert cell
// viewof player = youtubePlayer('EcZdXfv5LW4')
Insert cell
Insert cell
midi
Insert cell
Cdecay + Ddecay + Edecay
Insert cell
Insert cell
eases = [
d3.easeElasticIn.amplitude(2).period(2.7),
d3.easePolyInOut.exponent(7),
d3.easeBack.overshoot(2.7),
d3.easeBack.overshoot(2.7),
d3.easeElasticIn.amplitude(2).period(2.7),
]
Insert cell
makeCurve(eases[0])
Insert cell
makeCurve(eases[1])
Insert cell
makeCurve(eases[2])
Insert cell
makeCurve(eases[3])
Insert cell
makeCurve(eases[4])
Insert cell
Insert cell
Insert cell
Insert cell
keys = ["a", "s", "d", "f", "g"]
Insert cell
Insert cell
Insert cell
function* decayer2(note, ease) {
while (true) {
note.alpha = note.alpha <= 0 ? 0 : note.alpha - decay
yield Promises.delay(fps, ease(note.alpha));
}
}
Insert cell
Insert cell
words = { return { "C": "want", "D": "those", "E": "likes"} }
Insert cell
Insert cell
amplitude = scaler(1, 100)(midi.c2)
Insert cell
frequency = scaler(1, 40)(midi.c3)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
height = 500
Insert cell
fontSize = 250
Insert cell
radius = 3;
Insert cell
spacing = scaler(8, 20)(midi.c1)
Insert cell
scaler = function(min, max) {
return function(num) {
return d3.scaleLinear()
.domain([0, 127])
.range([min, max])(num || 0)
}
}
Insert cell
collisionStrength = 0.1;
Insert cell
Insert cell
Insert cell
// reset = {
// if(f > 0.90) {
// pixels.forEach(function(p) {
// p.x += Math.random() * 100 - 50
// p.y += Math.random() * 200 - 100
// })
// simulation.alpha(0.5)
// return true
// }
// return false
// }
Insert cell
// mutable simulation = {
// let sim = d3.forceSimulation(pixels)
// .velocityDecay(0.2)
// .force("x", d3.forceX(function(d) { return d.xTarget; }).strength(collisionStrength))
// .force("y", d3.forceY(function(d) { return d.yTarget; }).strength(collisionStrength))
// .force("collide", d3.forceCollide().radius(function(d) { return d.rTarget; }))
// return sim
// }
Insert cell
// simulating = {
// tick; simulation.tick()
// return true
// }
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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