« How to give the worst possible presentation | Main | Don't abuse those poor tireless pixels ... »

Politician Bobble Heads using Silverlight

I have no idea what inspired this.

image

See for yourself here. You'll need Silverlight 1.0 installed.

This is in no way any indication of any political affiliation -- or any indication of anyone I may vote for in the primary or general election. I had actually hoped to get more "heads" done this afternoon, but I ran out of time after these two.

The Silverlight code was very simple in this first edition. I added a few Mouse handlers:

rootElement.addEventListener("MouseMove", 
Silverlight.createDelegate(this, this.handleMouseMove));

The handler above was used to move the hand around:

handleMouseMove: function(sender, eventArgs) 
{    
  var hand = this.control.content.findName("hand");
  var pt = eventArgs.GetPosition(null);
  
  hand["Canvas.Left"] = pt.X - hand["Width"] / 2 ;
  hand["Canvas.Top"] = pt.Y - hand["Height"] / 2;
}

The mouse down was even simpler:

handleMouseDown: function(sender, eventArgs) 
{    
  this.control.content.findName(sender.Name + "Bobble").Begin();
  this.control.content.findName("WhackHand").Begin();
},
Help support my web site by searching and buying through Amazon.com (in assocation with Amazon.com).