Last active
March 29, 2017 13:19
-
-
Save willglanville/1515d1ae4174c6bbaa4f28eb8ecc72c5 to your computer and use it in GitHub Desktop.
Circle Wave Mutated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <svg id="container" width="960" height="500"></svg> | |
| <script src="https://d3js.org/d3.v4.min.js"></script> | |
| <script> | |
| var svg = d3.select("svg"), | |
| width = +svg.attr("width"), | |
| height = +svg.attr("height"), | |
| angles = d3.range(0, 2 * Math.PI, Math.PI / 200); | |
| var path = svg.append("g") | |
| .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")") | |
| .attr("fill", "green") | |
| .attr("stroke-width", 20) | |
| .attr("stroke-linejoin", "round") | |
| .selectAll("path") | |
| //.data(["cyan", "magenta", "yellow"]) | |
| .data(["red", "blue", "yellow"]) | |
| .enter().append("path") | |
| .attr("stroke", function(d) { return d; }) | |
| .style("mix-blend-mode", "difference") | |
| .datum(function(d, i) { | |
| return d3.radialLine() | |
| .curve(d3.curveLinearClosed) | |
| .angle(function(a) { return a; }) | |
| .radius(function(a) { | |
| var t = d3.now() / 500; | |
| return 200 + Math.cos(a * 8 - i * 2 * Math.PI / 3 + t) * Math.pow((2 + Math.cos(a - t)) / 2, 3) * 32; | |
| }); | |
| }); | |
| d3.timer(function() { | |
| path.attr("d", function(d) { | |
| return d(angles); | |
| }); | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment