Skip to content

Instantly share code, notes, and snippets.

@seekshreyas
Created February 22, 2013 00:11
Show Gist options
  • Save seekshreyas/5009672 to your computer and use it in GitHub Desktop.
Save seekshreyas/5009672 to your computer and use it in GitHub Desktop.
INFO247 / Lab 5 / #1
{"description":"INFO247 / Lab 5 / #1","endpoint":"","display":"div","public":true,"require":[{"name":"raphael.js","url":"http://poezn.github.com/raphael/raphael.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":15},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":15},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":15},"newfile.js":{"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}
// School of Information, UC Berkeley
// INFO 247 Lab 5: Raphaël.js
// http://blogs.ischool.berkeley.edu/i247s13/lab-5-raphael-js/
// Get the dimensions of the content window. This is something specific to Tributary
// and has nothing to do with Raphaël.js
var contentHeight = tb.sh,
contentWidth = tb.sw;
// HTML element to use for visualization
var contentElement = "display";
// Finally, let's create a "paper": A canvas you can draw on.
var paper = Raphael(contentElement, contentWidth, contentHeight);
// ===========================================================
// START DRAWING HERE
// Let's draw a circle!
// Here's how you do it:
// http://raphaeljs.com/reference.html#Paper.circle
var c = paper.circle(100,100, 100);
var r = paper.rect(40, 40, 50, 50, 10);
r.attr("fill", "#BADA55");
r.attr("stroke-width", 10);
c.attr("fill", "#ff0000");
c.attr("stroke-width", 10);
r.attr("opacity", 0.5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment