D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
lewis500
Full window
Github gist
lewislehe
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> // Feel free to change or delete any of the code you see in this editor! var svg = d3.select("body").append("svg") .attr("width", 960) .attr("height", 500) var colorScale = d3.scaleSequential(d3.interpolateInferno) .domain([0, 1]) d3.interval(()=>{ let circle = svg.append('circle') .attr('cx', Math.random()*960) .attr('cy', Math.random()*500) .attr('r',0) .attr('fill', colorScale(Math.random())) circle .transition() .duration(1600) .ease(Math.random() < .5 ? d3.easeBounceOut : d3.easeCubicOut) .attr('r', Math.random()*20) .attr('fill', colorScale(Math.random())) d3.timeout(()=> { circle.transition().ease(d3.easeCubic).attr('r',0).on('end',()=> circle.remove()) }, 1800) },100) svg.append("text") .text("I'm Lewis Lehe!") .attr("y", 200) .attr("x", 120) .attr("font-size", 36) .attr("font-family", "monospace") </script> </body>
https://d3js.org/d3.v4.min.js