Skip to content

Instantly share code, notes, and snippets.

@phawk
Created January 3, 2013 16:54
Show Gist options
  • Save phawk/4444844 to your computer and use it in GitHub Desktop.
Save phawk/4444844 to your computer and use it in GitHub Desktop.
var rect1 = new Rect();
rect1.color('blue'); // any CSS colour value
rect1.position(100, 200); // x, y
rect1.size(300, 150); // width, height
rect1.show(); // Shows the rectangle on screen (appends it to body)
rect1.hide(); // Detatches the rectabgle from the DOM
// I would also love a shorthand way of specifying the arguments in the
// constructor, at least the width, height and colour.
var rect2 = new Rect(200, 100, 'red'); // width, height, colour - All optional
rect2.position(300, 100);
rect2.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment