Skip to content

Instantly share code, notes, and snippets.

@hemulin
Forked from anonymous/inlet.js
Created August 18, 2012 16:43
Show Gist options
  • Save hemulin/3388288 to your computer and use it in GitHub Desktop.
Save hemulin/3388288 to your computer and use it in GitHub Desktop.
just another inlet to tributary

No Previous Gist

{"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":600,"height":300,"hide":false}}
var radius = 250, xPos = 400, yPos = 400;
var red = "255", green = "255", blue = 255, opac = 0.8, i = 0;
var canvas = d3.select("svg").append("svg");
canvas.append("circle").attr("r", radius)
.attr("cx",400)
.attr("cy",400)
.style("fill", "rgb(130,120,"+blue+")")
.style("opacity", opac)
.on("mouseover", function() {i++; setVars;});
function setVars() {
blue = blue-5;
radius = radius*0.8;
xPos = (i%2 == 0) ? xPos/2 : xPos*2;
yPos = yPos;
opac = (opac > 0.5) ? opac-0.1 : 0.8;
d3.select(this).attr("r", radius)
.attr("cx",xPos).attr("cy",yPos)
.style("fill", "rgb(130,120,"+blue+")")
.style("opacity", opac);
}
Display the source blob
Display the rendered blob
Raw
<svg xmlns="http://www.w3.org/2000/svg" class="tributary_svg" width="1525" height="630"><svg><circle r="250" cx="400" cy="400" style="fill: rgb(130, 120, 255); opacity: 0.8;"/></svg></svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment