Created
March 27, 2017 21:28
-
-
Save puzzler10/4833fbafce1799d36e2e80eccb8deaad to your computer and use it in GitHub Desktop.
Transform example - order matters
This file contains 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> | |
<meta charset="utf-8"> | |
<style> | |
</style> | |
<svg width="500" 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"); | |
var radius = 10; | |
var point = {x: 10, y: 10 } ; | |
for(var i = 1; i <= 10; i++){ | |
svg.append("circle") | |
.attr("cx", point.x) | |
.attr("cy", point.y) | |
.attr("r", radius) | |
.attr("fill", "blue") | |
.attr("transform", "scale(" + (1 + i/5) + ") " | |
+ "translate(" + (i*40) + "," + (i*40) + ")"); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment