Skip to content

Instantly share code, notes, and snippets.

@jorgealarcon
Created April 9, 2013 17:49
Show Gist options
  • Save jorgealarcon/5347813 to your computer and use it in GitHub Desktop.
Save jorgealarcon/5347813 to your computer and use it in GitHub Desktop.
Tributary inlet
{"description":"Tributary inlet","endpoint":"","display":"svg","public":true,"require":[{"name":"d3.js","url":"http://d3js.org/d3.v3.min.js"}],"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}},"fullscreen":false,"play":true,"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}
var textstring = "Hello, world!"
var textx = 120
var texty = 95
var fontsize = 198
var squarex = 98
var squarey = 73
var squaresize = 211
var squarefill = "#FF4242"
var squareopacity = 0.72
var circlex = 277
var circley = 277
var circlesize = 120
var circlefill = "#0B4F85"
var circleopacity = 0.56
var sw = parseInt(d3.select("svg").style("width"))
sw += .1 * sw
var sh = parseInt(d3.select("svg").style("height"))
var svg = d3.select("svg")
.attr("width", sw)
.attr("height", sh)
.append("svg:g")
var text = svg.append("svg:text")
.attr("x", textx)
.attr("y", texty)
.text(textstring)
.attr("class", "letter")
.style("font-size", fontsize)
var square = svg.append("svg:rect")
.attr("x", squarex)
.attr("y", squarey)
.attr("width", squaresize)
.attr("height", squaresize)
.style("fill", squarefill)
.style("opacity", squareopacity)
var circle = svg.append("svg:circle")
.attr("cx", circlex)
.attr("cy", circley)
.attr("r", circlesize)
.style("fill", circlefill)
.style("opacity", circleopacity)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment