forked from enoex's block: data yoga 1
Created
September 9, 2015 02:26
-
-
Save erikhazzard/2f079ce55bf11b5fc3a0 to your computer and use it in GitHub Desktop.
breathe
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://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> | |
</head> | |
<body> | |
<svg width=960 height=500 > | |
</svg> | |
<script> | |
var svg = d3.select('svg'); | |
var rect = svg.append('rect') | |
.attr({ | |
x: 0, | |
y: 0, | |
width: 960, | |
height: 300 | |
}) | |
.style({ | |
fill: "#336699" | |
}); | |
function breathe(){ | |
rect.transition().duration(1200).attr({ | |
transform: 'scale(' + Math.random() + ')' | |
}).each('end', breathe); | |
} | |
breathe(); | |
</script> | |
</body> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment