[ Launch: fontthing ] e4529ae9288919b0f080 by georules
[ Launch: fontthing ] 52a849be291b8adf8628 by georules
[ Launch: test ] 4653053 by enjalot
[ Launch: test ] 4652017 by enjalot
[ Launch: test ] 4582399 by enjalot
-
-
Save georules/e4529ae9288919b0f080 to your computer and use it in GitHub Desktop.
fontthing
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":"fontthing","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"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}},"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"tab":"edit","display_percent":0.7,"thumbnail":"http://i.imgur.com/Z4ghHZY.png","fullscreen":false,"ajax-caching":true,"inline-console":false} |
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 svg = d3.select("svg") | |
model = {} | |
model.s = "CODESLAM" | |
data = s.split("") | |
console.log(data) | |
fontsize=50 | |
var fonts = ['Arial','Arial Black','Bookman Old Style','Century Gothic','Comic Sans','Consolas','Courier','Georgia','Helvetica','Impact','Lucida','Cambria','Tahoma','Trebuchet','Verdana','Monotype Corsiva','Monotype Sorts'] | |
svg.selectAll("text").data(data).enter().append("text") | |
.attr({ | |
x: 200, | |
y: 184, | |
'font-size':fontsize, | |
fill: "#000000" | |
}).text(function(d,i){ | |
flip=Math.floor(Math.random()*2) | |
return d.toLowerCase() | |
return flip ? d.toUpperCase() : d.toLowerCase() | |
}); | |
var picked = [] | |
d3.selectAll("text") | |
.attr("x", function(d,i) { | |
return i * fontsize * 0.66 | |
}) | |
.attr("font-family", function(d,i) { | |
i = Math.floor(Math.random()*fonts.length) | |
if (picked.indexOf(i)>0) { | |
i = Math.floor(Math.random()*fonts.length) | |
} | |
// picked.append(i) | |
console.log(i) | |
return fonts[i] | |
}) | |
Object.observe(model, function(changes) { | |
console.log(changes) | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment