Skip to content

Instantly share code, notes, and snippets.

@mikechambers
mikechambers / Drone_Follow_Multiple_Stage_1.html
Created January 25, 2011 17:56
HTML document body for Drone Follow Example
<body>
<canvas id="mainCanvas" width="600" height="400"></canvas>
</body>
@mikechambers
mikechambers / BitmapSequence Bug
Created February 25, 2011 17:31
Code showing bitmap sequence not working when no frameData is specified.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Flash to Canvas Animation Example</title>
<script src="easel.js"></script>
<script>
var stage;
@mikechambers
mikechambers / BitmapSequence Bug
Created February 25, 2011 17:36
Showing fix for animating with no frameData
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Flash to Canvas Animation Example</title>
<script src="easel.js"></script>
<script>
var stage;
@mikechambers
mikechambers / BoundsNode.prototype.clear
Created March 19, 2011 19:30
Recursive Call for Clearing Nested nodes
BoundsNode.prototype.clear = function()
{
this._stuckCount = 0;
//array
this.children.length = 0;
var len = this.nodes.length;
if(!len)
@mikechambers
mikechambers / EaselJS cache switching
Created March 19, 2011 20:38
Switching between cache states
Circle.prototype._collidingCacheCanvas = null;
Circle.prototype._normalCacheCanvas = null;
Circle.prototype._draw = function()
{
if(this.isColliding)
{
if(this._collidingCacheCanvas)
{
this.cacheCanvas = this._collidingCacheCanvas;
return;
//check version of data to see if we need to update it
//have to think about if we exceed storage quota, so we would need to check for how much space
//we need before we write, and then, if we need more, request more from the user before we write.
//of course, that is async, so somehow we have to save the state while we wait for the user to respond
;(function(){
"use strict";
function SpectralKitten()
@mikechambers
mikechambers / gist:2370306
Created April 12, 2012 19:22
Playing around ideas for prototype based inheritance that also provides private properties.
function Foo()
{
var _a = "hello";
if(!Foo.prototype.bar)
{
Foo.prototype.bar = function()
{
console.log("hi " + _a);
};
@mikechambers
mikechambers / gist:2409162
Created April 17, 2012 21:25
List Example
<div id="view1" class="viewcontainer">
<div class="list" id="set_list" >
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 2</li>
<li>Item 2</li>
<li>Item 2</li>
<li>Item 2</li>
<li>Item 2</li>
@mikechambers
mikechambers / default.css
Created May 4, 2012 06:27
Example that shows how to dynamically apply and remove style sheets
.test {
color:#FF0000;
}
function _normalizeKeyDescriptorString(origDescriptor) {
var hasCtrl = false,
hasAlt = false,
hasShift = false,
key = "";
function _isModifier(left, right, previouslyFound) {
if (!left || !right) {
return false;
}