Skip to content

Instantly share code, notes, and snippets.

@halfmanhalfdonut
Created October 14, 2011 16:34
Show Gist options
  • Save halfmanhalfdonut/1287616 to your computer and use it in GitHub Desktop.
Save halfmanhalfdonut/1287616 to your computer and use it in GitHub Desktop.
Basketball shell
var Basketball; // The only thing I smoke are fools like you on the b-ball court
// So our basketball needs to take some options -- namely if it's using ball trails or not. Yes? Yes.
// We also need it to keep track of its own bounding box. That is, the minimum and maximum X/Y values
// We can probably reduce mouse trail load by making them one shape rather than multiple circles.
(function() {
Basketball = function(keanu, opts, duration) {
if (!keanu) return; // Well forget YOU, then. No where to draw this bad boy!
this.keanu = keanu;
this.origin = opts.origin || []; // origin -- [x, y, radius]
this.control = opts.control || []; // control points, middle of the curve from origin to destination
this.destination = opts.destination || []; // destination -- [x, y, radius]
this.animationMiddle = opts.animationMiddle || 2; // What are we dividing the length by for a "midpoint?"
this.shape = opts.shape || this.keanu.circle; // default to a circle -- it IS a ball after all
this.easing = opts.easing || "linear"; // default to none (linear)
this.callback = opts.callback; // When the animation completes, fire it up! Or nothing, whichever
this.styles = opts.styles || {}; // Hash of properties, completely unnecessary though
this.useTrail = opts.useTrail || true; // This option is for low-end browsers
};
// Grab the minimum/maximum x and y values - this keeps our canvas redraws smmmmaaalllllerrrrr
Basketball.prototype.getBoundingBox = function() {
};
// This kind of brings the ball to life, no?
Basketball.prototype.drawTrail = function() {
};
// Without this, the ball is nothing. NOTHING. I mean, this just gives it an added dimension. Ask wolfmother.
Basketball.prototype.drawShadow = function() {
};
// Hmm, they missed. Make it randomly pop back away from the backboard (hence the "side" of the court)
Basketball.prototype.putsUpABrick = function(side) {
};
// This is the actual callback we are going to fire when Keanu publishes "enterFrame"
Basketball.prototype.draw = function() {
console.log(this);
};
Basketball.prototype.version = "0.0.0.0.0.0.1-theta-confirmed";
Basketball.constructor = Basketball;
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment