Rectangle animation examples - silverlight

Are there any examples on the internet of silverlight animation which can do the following:
A rectangle zooming in
A rectangle going down from a certain position on the x axis to a certain position on the x axis
I looked on silverlight.net but couldn't find these examples (which are quite rudimentary). Anyone know where I can see an example with source for this?
Thanks

Do a ScaleTransform for the zooming effect and Translate transform for the move effect. I am sure you can find out lot of examples in a search for "Silverlight Animation". It doesnt matter it is rectangle or any other UIElement
http://www.wynapse.com/Silverlight/Tutor/Clipping_Silverlight_Animated_Rectangles.aspx
http://www.developerfusion.com/article/7303/have-you-seen-the-silverlight-more-silverlight/2/

Related

WP7: 3D Perspective Camera Depth Effect

Lets say I have a Canvas with one Image centered on the screen. When I move the image away from the center, lets say to the upper right corner, I want it to be skewed as if the Canvas was a perspective 3d-camera with a certain FOV. Can this be done somehow? Im playing around with the Perspective-property in Silverlight for WP7 but I cant get the effect Im after.
I believe this may be what you're looking for: How to Set this Kind of Perspective Transform in Matrix3D?

Resize Clipping Path on window resize in WPF

I was wondering how to resize a Clipping path dynamically when resizing the window. Right now I'm taking a rectangle in Expression Blend that resizes with the window. Applying this rectangle to a circle as a clipping path makes the rectangle fixed, and it won't resize anymore.
I've seen different ways of making clipping paths in XAML, in the Clip="" property as well as style markup. But I haven't succeeded yet in finding a proper XAML solution.
Can anyone point me in the right direction?
Thanks!
I was searching for an answer to the the same question (that's how I found your post) and I came across this:
http://chriscavanagh.wordpress.com/2008/10/03/wpf-easy-rounded-corners-for-anything/
Not sure it will work for you if you have a more complex shape that you would like to use as the clipping path, but if you are just looking to round some corners that will scale automatically, I suggest you check it out. It uses a VisualBrush bound to a border element instead of a clipping path. So far I have found it to be a pretty elegant solution for my needs.

Making a "Fuzzy border" in Silverlight 3.0

I would like to have fuzzy looking border around my Canvas control. Basically, I am creating a Print Preview screen, and I want it to look almost exactly like the one in Word 2010. In this, there is a thin gray line, a thin orange line and then a fuzzy gradient around the outside of the page. Check it out and you will see what I mean.
Can anyone tell me how I can do this with my Canvas control?
Answer was in the comments. Thanks!
Here it is:
Does SL3 support BitmapEffects or ShaderEffects? If so, just drop a border on the bottom and give it a fuzzy effect. Just make sure not to put anything IN the border, just lay it on top of the border inside the canvas.

WPF Canvas: centered origin, scaled axes (and y inverted), responding to mouse events

In a simple code-only WPF application I'm writing, I would like to have a custom Canvas.
I've found questions similar to this one here in StackOverflow, but couldn't find exactly this one, nor a simple way to adapt another answer to my specific problem (please note that I have not much experience in WPF).
In my canvas, I'd like it to have the following properties:
the point (0, 0) is on the center of the Canvas;
the x-axis points to the right;
the y-axis points to the top;
the point (1, 0) is about 1 inch to the right of the origin; and
in every event, the position of the mouse is given in the coordinate system defined above.
In this answer, Ray Burns propose a very simple solution to my first 3 points. It is trivial to modify that code so that it deals with my point number 4 as well (change 1 and -1 in the RenderTransform to other constants).
However, that very simple and excellent solution for many problems is based on setting width and height to 0, and centering the canvas on its container. Therefore, there's no canvas to capture events like a click, so this solution won't handle my fifth property.
What's the easiest way to achieve this? Inherit from Panel and do everything by hand? Inherit from Canvas, intercept every event and modify the coordinates?
Put Canvas inside a Border. Border has mouse events. Another case is to place Border on the top of the Canvas.

WPF: How do I implement a stretch transform?

I am trying to implement an effect that will stretch a polygon along a line from its center point to the mouse location. I've tried various approaches with a SkewTransform and the planar angle between those two points but that isn't giving me what I want.
I am kind of assuming I'll have to go the MatrixTransform route but my linear algebra is pretty rusty.
You can either use the ScaleTransform and just apply it in one direction then combine it with a RotateTransform if the direction you need to stretch in isn't just plain x or y, or take a look at the Stretch property on the shape.
There's a good article on CodeProject that has some examples.
MSDN also has some reference material.

Resources