3D Space is back! My first post 3D Text Space received a lot of comments and I decided to apply the logic on images. The effect is much more groovy than the original one! No 3D Library is needed.
You may now vote for your favorite sample!
Vote for this sample
Comparison
Flash implementation: 1 hour
Silverlight implementation: 40 minutes
What’s the difference?
- Scaling: scaleX, scaleY [AS3] vs ScaleTransform [C#]
Source codes
3D Image Space [Flash 9, AS3] (407.5 KiB, 2,919 hits)
3D Image Space [Silverlight 2, C#] (952.6 KiB, 7,015 hits)
Flash
Silverlight
Scaling: scaleX, scaleY [AS3] vs ScaleTransform [C#]
Scaling in both AS3 and C# look similar. However, you can only scale up a object in AS3 from the perspective point (0, 0). That means, the object will only be extended to the bottom right corner. There are many workarounds for solving this, like putting the image in to a Sprite.
// AS3 // Scaling must be based on the perspective 0, 0 image.scaleX = scale; image.scaleY = scale; // Using different perspective var sprite:Sprite = new Sprite(); image.x = -image.width/2; image.y = -image.width/2; sprite.addChild(image); sprite.scaleX = scale; sprite.scaleY = scale;
In Silverlight, you can scale up the image using different perspective easily. May be we can consider it’s a strength comparing with Flash.
// C# // Scale up the image using different ScaleTransform scaleTransform = new ScaleTransform(); scaleTransform.ScaleX = scale; scaleTransform.ScaleY = scale; scaleTransform.CenterX = image.Width/2; scaleTransform.CenterY = image.Height/2; image.RenderTransform = scaleTransform;