D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
deoqc
Full window
Github gist
simplest
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://d3js.org/d3.v4.min.js"></script> <style> body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } </style> </head> <body> <script> var svg = d3.select("body").append("svg") .attr("width", 960) .attr("height", 500) var selection = svg .append("g") .attr("transform", "translate(120)") .selectAll("text") .data("Edit the code below to change me!".split("")) function repeat() { d3.active(this) .duration(0) .style("opacity", 1e-6) .attr("fill", "red") // .attr("x", -120) .transition() .duration(1500) .style("opacity", 1) .attr("fill", "black") // .selectAll("text") // .attr("x", function(d, i) { return i*20 }) .transition() .duration(1500) .style("opacity", 1e-6) .attr("fill", "green") // .attr("x", 840) .transition() .on("start", repeat) } selection.enter() .append("text") .text(function(d) { return d }) // .attr("y", 200) .attr("x", -150) .attr("font-size", 36) .attr("font-family", "monospace") svg.selectAll("text") .transition() .duration(1) .attr("x", function(d, i) { return i*20 }) .on("start", repeat) </script> </body>
https://d3js.org/d3.v4.min.js