Published
Edited
Dec 21, 2020
1 fork
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Vitesse d'alternace vers le blanc en ms.
vitesse = 1000;
Insert cell
Insert cell
function dessin(step){
d3.select("g#forme")
.append("path")
.attr("d", pathInterpolatorA(step))
.style("fill", colorInterpolator(step))
.style("stroke", "none");

d3.select("g#forme")
.append("path")
.attr("d", pathInterpolatorB(step))
.style("fill", colorInterpolator(step))
.style("stroke", "none");
}
Insert cell
Insert cell
// Boucle de dessin des étapes
dessinFormes = {
for (let i=1; i<=steps; i++){
dessin(i/steps);
}
d3.selectAll("path").each(function(d) {
changeElementColor(this, 1000);
});
return "steps"
}
Insert cell
// Variation de la couleur
function changeElementColor(d3Element, vitesse){
var e = d3.select(d3Element);
var couleurOrigine = e.style("fill");
e
.transition()
.on("start", function repeat() {
d3.active(this)
.transition().duration(vitesse)
.style("fill", "white")
.transition().duration(vitesse)
.style("fill", couleurOrigine)
.on("end", repeat);
});
}
Insert cell
da0 = "m 50,141 c 0,0 58.90033,-39.26689 81.99849,-8.08436 23.09817,31.18253 40.42179,32.33743 34.64725,61.21014 -5.77454,28.87271 -24.25307,55.4356 -48.50615,55.4356 -24.25307,0 -78.53377,-21.94325 -78.53377,-38.11197 0,-25.40799 -24.25307,-45.04143 10.39418,-70.44941 z"
Insert cell
da1 = "m 100,180 c 0,0 -2.35887,-1.12756 -1.92999,-3.3075 0.42889,-2.17994 2.35888,0.45103 3.35961,0.90205 1.00074,0.45102 1.85851,1.05238 2.64481,2.17994 0.78629,1.12755 1.07221,4.51023 -0.50037,4.20954 -2.05126,-1.15576 -2.24463,-2.69408 -3.57406,-3.98403 z"
Insert cell
db0 = "m 251.88658,49.15062 c 0,0 4.68856,-55.63155 30.38189,-38.56882 25.69332,17.06273 33.57813,11.30391 45.93296,37.64341 12.35483,26.3395 18.17831,55.68117 7.96759,65.09307 -10.21071,9.41191 -44.30059,12.16174 -52.58074,-1.33346 -13.01164,-21.20677 -33.27679,-28.18188 -31.7017,-62.8342 z"
Insert cell
db1 = "m 300,64 c 0,0 -2.35887,-1.12756 -1.92999,-3.3075 0.42889,-2.17994 2.35888,0.45103 3.35961,0.90205 1.00074,0.45102 1.85851,1.05238 2.64481,2.17994 0.78629,1.12755 1.07221,4.51023 -0.50037,4.20954 -2.05126,-1.15576 -2.24463,-2.69408 -3.57406,-3.98403 z"
Insert cell
Insert cell
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