Skip to content

Instantly share code, notes, and snippets.

@petabyte
Created June 11, 2013 06:22
Show Gist options
  • Save petabyte/5754816 to your computer and use it in GitHub Desktop.
Save petabyte/5754816 to your computer and use it in GitHub Desktop.
round face
{"description":"round face","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}},"fullscreen":false,"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}
//Lets try to draw a big happy face
var svg = d3.select("svg");
// Head
svg.append("circle")
.attr("cy", 245)
.attr("cx", 319)
.attr("r", 273)
.style("fill", "#3D3D3D")
.style("fill-opacity", 0.22)
.style("stroke", "#535353")
.style("stroke-width", 20);
//Mouth
svg.append("rect")
.attr("width", 330)
.attr("height", 54) // Change this to make him talk
.attr("x", 149)
.attr("y", 349)
.attr("rx", 37)
.style("fill", "#242424")
.style("fill-opacity", 0.7656)
.style("stroke-width", 0);
// Nose
svg.append("circle")
.attr("cx", 314)
.attr("cy", 253)
.attr("r", 52)
.style("fill", "#F10E0E")
.style("fill-opacity", 0.22)
.style("stroke", "#535353")
.style("stroke-width", 10)
// Eyes
svg.append("circle")
.attr("cx", 181)
.attr("cy", 148)
.attr("r", 63)
.style("fill", "#FFFFFF")
.style("fill-opacity", 0.7656)
.style("stroke", "#535353")
.style("stroke-width", 5)
svg.append("circle")
.attr("cx", 420)
.attr("cy", 153)
.attr("r", 59)
.style("fill", "#FFFFFF")
.style("fill-opacity", 0.7656)
.style("stroke", "#535353")
.style("stroke-width", 5)
// Pupils
svg.append("rect")
.attr("width", 59)
.attr("height", 53)
.attr("x", 411)
.attr("y", 149)
.attr("rx", 37)
.style("fill", "#242424")
.style("fill-opacity", 0.7656)
.style("stroke-width", 0)
svg.append("rect")
.attr("width", 61)
.attr("height", 57)
.attr("x", 172)
.attr("y", 149)
.attr("rx", 37)
.style("fill", "#242424")
.style("fill-opacity", 0.7656)
.style("stroke-width", 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment