Created
November 11, 2015 15:00
-
-
Save shprink/15009b5eb82a97055257 to your computer and use it in GitHub Desktop.
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 this.options = { | |
count: 3, | |
from: -60, | |
to: 60 | |
}; | |
var from = Math.max(-90, Math.min(90, +this.options.from)); | |
var to = Math.max(-90, Math.min(90, +this.options.to)); | |
var rotateScale = d3.scale.linear().domain([0, this.options.count - 1]).range([from, to]); | |
this.layout = d3.layout.cloud() | |
.timeInterval(Infinity) | |
.size([this.getWidth(), this.getHeight()]) | |
.padding(5) | |
.fontSize(function(d) { | |
return self.fontSize(+d.value); | |
}) | |
.rotate(function() { | |
return rotateScale(~~(Math.random() * self.options.count)); | |
}) | |
.text(function(d) { | |
return d.text; | |
}) | |
.on("end", draw); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment