Resetting input handlers in EaselJS

I've been working on some stuff in EaselJS. Recently I typed up a little object to handle managing different Scene type things in a stage. Each scene inherits off a collection, but the superglobal inputs were bugging me, so I wrote this up to default out the input handlers and not have to worry about the game's scale.

In the game's resize I set the self's (just the this of the object) inverseScale to be equal to 1 / the original Canvas scale for each dimension.

It's been working well so far!

this.switchScene = function (newscene, retain) {

      if (self.currentScene) {
        createjs.Ticker.removeListener(self.currentScene);
        if (!retain) {
          self.currentScene.removeAllChildren();
          delete self.currentScene;
        }
        this.stage.removeAllChildren();
      }
      self.currentScene = newscene;

      //reset input handlers
      (function (target) {
        ['onMouseDown', 'onMouseMove', 'onMouseUp', 'onPress', 'onClick'].map(
          function (inputType) {
            if (newscene.hasOwnProperty(inputType)) {
              target.stage[inputType] = function (event) {
                event.stageX *= self.inverseScale.x;
                event.stageY *= self.inverseScale.y;
                return newscene[inputType](event);
              };
            } else {
              target.stage[inputType] = undefined;
            }
          }
        );
      })(self);

      self.stage.addChild(newscene);
      self.stage.update();
    };

On Writing a Simple Google Wave TODO List

Screen shotGoogle Wave has been accused of being a way to make people feel like how older people feel when they use the internet. I definitely found this to be true during my first couple of weeks using the platform. The volume of stimuli received even in a three-person wave can be pretty overwhelming.

I figured that I'd need to write a little Wave gadget before I actually grokked the platform. I figured that a to-do list would be somewhat useful and fairly simple to code up. I built this thing up one day on my lunch break.

Here's a link to the gadget for your consumption.  I've started a public wave for feature requests and discussion and such.
Continue reading "On Writing a Simple Google Wave TODO List"

Drawingification in the PhotoChops

Before
Before
Drawingified
Drawingified

Here's a before and after of something that I put together with the photochop webappy thing that I put together.  This one was created by reducing the colors of the image, blurring the result and applying the drawingify filter.

The drawingify filter takes the original image, blurs it, averages the result with the original image, then applies the photocopy filter and blurs that result.  This generally gives a fairly convincing pencil-drawing style effect.

Seeing as this is mainly a test of HTML5's canvas element, it'll die a fiery death on internet explorer, but should work happily on most modern browsers.  Savepoint averaging only works on Firefox 3.5 due to some awkward security settings on other implementations.