[ Launch: bubble chart ] a2e0f744f4201b6e159c by dominikus
[ Launch: scatterplot 2 ] 3f497bfcbaed088be8a7 by dominikus
[ Launch: minimal_sqrt ] 551abf81a2b8f91fa01d by dominikus
[ Launch: minimal_scales ] 775bce9da2138937fb84 by dominikus
[ Launch: minimal_enter_2 ] 7a514689371af1166681 by dominikus
[ Launch: minimal_enter ] f0288c71ee49863fd7d9 by dominikus
[ Launch: minimal_enter ] c13dcfaddc12236c645a by dominikus
-
-
Save dominikus/a2e0f744f4201b6e159c to your computer and use it in GitHub Desktop.
basic transitions
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
| {"description":"basic transitions","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"styles.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true,"thumbnail":"http://i.imgur.com/4rywzkU.png"} |
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
| var x = 50; | |
| var y = 50; | |
| d3.select("svg") | |
| .append("circle") | |
| .attr("cx", x) | |
| .attr("cy", y) | |
| .attr("r", 30); | |
| var animate = function(){ | |
| if(x === 50){ | |
| x = 500; | |
| y = 500; | |
| } else { | |
| x = 50; | |
| y = 50; | |
| } | |
| d3.selectAll("circle") | |
| .transition() | |
| .attr("cx", x) | |
| .attr("cy", y) | |
| .duration(2000) | |
| .each("end", animate); | |
| }; | |
| animate(); | |
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
| svg { | |
| background: #fff; | |
| } | |
| circle { | |
| fill: white; | |
| stroke: #333; | |
| stroke-width: 3px; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment