Skip to content

Instantly share code, notes, and snippets.

@shawngmc
Created February 22, 2016 20:04
Show Gist options
  • Save shawngmc/67ba18f51eaea4953395 to your computer and use it in GitHub Desktop.
Save shawngmc/67ba18f51eaea4953395 to your computer and use it in GitHub Desktop.
test
{"description":"test","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,"ajax-caching":true}
var svg = d3.select("svg")
var box = svg.append("rect")
.attr({
width: 100,
height: 100,
x: 200,
y: 62,
fill: "#3BA360"
});
box.on("click", function(d) {
var oldPos = box.attr("x");
var newPos = 0;
if (parseInt(oldPos) === 100) {
newPos = 300;
} else {
newPos = 100;
}
box.transition().attr("x", newPos);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment