The SDDN brings you “Silverlight in a day!”

January 27, 2009

Announcing “Silverlight in a day” – a full day of hands on Silverlight training brought to you by the SDDN – FREE!

When: Saturday 21st February 2009
Cost: NOTHING! (lunch is provided)
Where: Level 2, Cliftons, 440 Collins St, Melbourne
Contact: info@sddn.org.au to reserve your spot!

The SDDN has been a little quiet since its first meeting in December – but there is a great reason! Mahesh, Phil and myself have been busy organising this fantastic event.

The SDDN invites you to come along and get your hands dirty with Silverlight 2! Learn how to build Silverlight Applications using Visual Studio and Expression Studio.

In this instructor led one day course the 40 attendees will be able to work their way through hands-on labs and gain invaluable insight into the technology and how they can use it to create Rich Internet Applications (RIA).

Gain an understanding of varied Silverlight topics such as XAML, animation, data binding, communication and more and get the start you need to create great Silverlight applications!

Get in fast as spaces are limited!

Edit: The level of the training day is aimed at people who are new to Silverlight. The course is targeted at both designers and developers!


It’s Snowing in Silverlight

January 15, 2009

Late last year I was on a plane from Sydney to Melbourne to open the first Silverlight Designer and Developer Network meet.

I was thinking about how the night would go when I had the thought that it would be cool to have something to put on the projector to create some atmosphere whilst people are getting seated etc.

The idea I came up with was to take the SDDN logo and make some snow float around it. With the Animation Chainer under my arm and some spare time on the plane (about an hour) I got to work… turned out the job was easier than I thought.

The actual snow randomisation and animation code turned out to be about 10 lines!

Sample and demo

Live Demo

<Sample Code>

Snow Animation Sample Code

</Sample Code>

How it works

The basic premise is that the code loops through 200 times and creates random sized Ellipse objects (the snow). It then applies a random animation to each Ellipse.

When the animation completes it automatically calls back in the animation creation method to kick off the next animation.

The length of each animation is randomised to create a more natural looking snow field… also this serves to ensure that there is no delay/freeze whilst Silverlight is processing the end animations.

void reDoAnims(AnimationConfig g, object context)
{
	// the main guts of the animation... each time one animation finishes, this code is called by the callback.
	Ellipse tt = context as Ellipse;

	double maxWidth = this.ActualWidth;
	double maxHeight = this.ActualHeight;

	double moveTop = (double)randNo.Next(0, Convert.ToInt32(maxHeight));
	double moveLeft = (double)randNo.Next(0, Convert.ToInt32(maxWidth));

	int keyTime = randNo.Next(10, 20);

	m.Add()
		   .DoubleAnimationK()
		   .Target(tt)
		   .Property(Canvas.LeftProperty)
		   .KeyFrame(moveLeft, new TimeSpan(0, 0, keyTime))
		   .Queue()
		   .DoubleAnimationK()
		   .Property(Canvas.TopProperty)
		   .KeyFrame(moveTop, new TimeSpan(0, 0, keyTime))
		   .TimelineContext(tt)
		   .TimelineCompleteAction(reDoAnims) // when this animation finishes call back this method to reinitialise the object.
		   .Queue();

	m.Begin(false, false);
}

Walking through the code from m.Add() on…

  • Create the animation group
  • Add a new double animation with keyframes
  • Set the target to the Ellipse (from the passed on Context)
  • Target the Ellipse’s Canvas.LeftProperty for animation
  • Add a keyframe… Animate Canvas.LeftProperty to “moveLeft” over “keyTime” length. Both values are randomised
  • Queue this animation and ready for another one
  • Create another double animation with keyframes
  • Target the Canvas.TopProperty this time
  • Once again, use the randomised values to animate
  • Set the context of the animation to the Ellipse. When the callback is called the Ellipse will be the context so the animation can be re-applied (with new random values)
  • Set the callback so when this animation completes another one is automatically created
  • Queue the animation
  • Begin the animations!

Download the code and enjoy!

Leading on from this my brother Alex and I created a little Christmas card for the clients of Readify.

View the Readify Christmas Card.

Wait for the snow to settle then shake the globe!