Built with blockbuilder.org
Last active
July 26, 2018 23:56
-
-
Save leorawe/faf01116b9562c037912b8475f45023e to your computer and use it in GitHub Desktop.
Learning Circles
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
license: mit |
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> | |
<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; } | |
.container { | |
width: 800px; | |
margin: 0 auto; | |
border: 1px solid #666666; | |
padding: 50px 0; | |
} | |
.mine { | |
width: 500px; | |
height: 400px; | |
background-color: #eee; | |
margin: 0 auto; | |
display: block; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<svg class="mine"></svg> | |
</div> | |
<script> | |
// Feel free to change or delete any of the code you see in this editor! | |
var svg = d3.select("svg"); | |
//var w = svg.width; | |
svg.append("text") | |
.attr("y", 100) | |
.attr("x", 50) | |
.attr("font-size", 24) | |
.attr("font-family", "Georgia") | |
.style("opacity", 0) | |
.text("Some text"); | |
svg.append("circle") | |
.attr("r", 50) | |
.attr("cx", 250) | |
.attr("cy", 200) | |
.attr("fill", "#507799"); | |
d3.selectAll("text").transition().delay(3000).style("opacity",1); | |
d3.selectAll("circle").transition().duration(2000).attr("cy",300); | |
d3.selectAll("circle").transition().duration(1000).attr("cy",100); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment