Sep 15
Kaleidoscope is an attractive toy for me when I was young. You can use any image you like and it will produce many amazing effects via mirror reflection.
You won’t be able to figure out the original image if you don’t download the source now~
Comparison
Flash implementation: 40 minutes
Silverlight implementation: 1 hour 30 minutes (Implemented First)
What’s the difference?
- Triangle Mask: mask [AS3] vs PathGeometry [C#]
Source codes
Kaleidoscope [Flash 9, AS3] (146.2 KiB, 1,954 hits)
Kaleidoscope [Silverlight 2, C#] (175.1 KiB, 1,686 hits)
Flash
Silverlight
Triangle Mask: mask [AS3] vs PathGeometry [C#]
The Kaleidoscope is created by masking an image with a triangle and duplicating the masked images.
// AS3 // Create a triangle mask var mask : Shape = new Shape(); mask.graphics.beginFill(0x000000); mask.graphics.moveTo(0, 0); // add the triangle points mask.graphics.lineTo(100, 100); mask.graphics.lineTo(0, 100); mask.graphics.lineTo(0, 0); mask.graphics.endFill(); // mask the current object this.mask = mask; // remember to add the mask to the stage addChild(mask);
In my previous article Water Effect, we have discussed how to clip the object easily using Ellipse or Rectangle. However, if you want to clip the object using irregular shape, some more work has to be done. Below is a demonstration.
// C# // Create a path geometry PathGeometry pathGeometry = new PathGeometry(); PathFigure pathFigure = new PathFigure(); pathFigure.IsClosed = true; pathFigure.StartPoint = new Point(0, 0); // add the triangle points PolyLineSegment polyLineSegment = new PolyLineSegment(); polyLineSegment.Points.Add(new Point(100, 100)); polyLineSegment.Points.Add(new Point(0, 100)); polyLineSegment.Points.Add(new Point(0, 0)); pathFigure.Segments.Add(polyLineSegment); pathGeometry.Figures.Add(pathFigure); // clip the current object this.Clip = pathGeometry;

September 16th, 2008 at 12:46 am
SilverLight is a memory hog :|. It looks that it moves in slow motion but flash works fine
September 16th, 2008 at 10:54 am
found http://www.mashooo.com/ a few months ago, with over 50 silverlight games, thought you might want to have look at the “draw” effects:)
September 16th, 2008 at 8:05 pm
Thanks unruledboy, the games are nice, especially the line runner.
September 25th, 2008 at 2:06 pm
[...] Comparisons. Mike Snow gives us a big caution and example of floating point comparison issues. Silverlight vs Flash: Kaleidoscope Terence Tsang tackled the Kaleidoscope this time out … runs very smoothly to my eyes… Throwing [...]
October 22nd, 2008 at 5:07 am
Nice site you have
November 17th, 2008 at 12:47 am
Ringraziamenti molto! Lo avete aiutato molto!
February 10th, 2009 at 8:15 am
if you use process explorer the silver light uses less cpu than flash
March 9th, 2009 at 8:07 pm
NOTE: Visitors should make sure that they refresh the page before each test as the second test loses some cycles to the still running first test. Both stutter to get going, which is interesting.
March 9th, 2009 at 8:12 pm
Flash consumes about 20% more CPU time which is good and bad. Good in that it gets what it wants to enhance the experience and bad for other apps.
Its difficult to argue that SL looks half the speed in the side-by-side but we know from the FPS stress test that SL seems to be much faster with small loads but drops off quicker the more that’s added to the screen.
July 14th, 2010 at 2:41 am
[...] Flash Silverlight Download [...]