[ Launch: circle-animation ] 7328929 by tanatana
-
-
Save tanatana/7328929 to your computer and use it in GitHub Desktop.
circle-animation
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
{"description":"circle-animation","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"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} |
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
var seed = new Array(32); | |
(function(){ | |
var i; | |
for(i = 0; i < seed.length;i++){ seed[i] = new Array(32)} | |
})(); | |
var svg = d3.select("svg") | |
var trigonometricScale = d3.scale.linear() | |
.domain([0, seed.length]) | |
.range([-3.1415, 3.1415]); | |
var selection = svg.selectAll("circle").data(seed); | |
selection.enter().append("circle") | |
.attr("cx", function(d,i) { return Math.cos(trigonometricScale(i))*1 + 300 }) | |
.attr("cy", function(d,i) { return Math.sin(trigonometricScale(i))*1 + 300 }) | |
.attr("r", 1) | |
.style("fill", "#000") | |
setTimeout(function(){ | |
selection | |
.transition() | |
.ease("cubic-in-out") | |
.duration(1000) | |
.attr("cx", function(d,i) { return Math.cos(trigonometricScale(i))*150 + 300 }) | |
.attr("cy", function(d,i) { return Math.sin(trigonometricScale(i))*150 + 300 }) | |
.attr("r", function(d,i){return 3}) | |
.style("fill", "#000") | |
},10); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment