Welcome to Windows Presentation Foundation (WPF)
Top Tasks :

WPF Team Bloggers

Browse by Tags

All Tags » WPF » Action Script   (RSS)

  • Inspired By Flash Math Creativity #3: WPF Flag

    There is a clever sample up on Flash Math Creativity by Lifaros that fundamentally does 2D morph meshing by chopping up an image into sections and then animating the sections, resulting in the effect of a flag waving. I decided to implement something similar in WPF. When I started thinking about how to chop up something in WPF, I remembered the Slide Puzzle sample from the SDK and I used it the foundation for how to chop, well, anything up in WPF. (If you haven't checked out this sample, definitely do so!) In my sample, I only chop up an image, but nothing is stopping you from using this same technique to chop up a video, a document or the UI itself. Once again, I used the custom animation classes to create the animation using Math.Sin . The slider allows you to modify the intensity of the wave. The result? The UN flag waving in the desert. I'm not sure why. Download source or run it . Here's the crux of the code: private void Chop() { stackPanel.Children.Clear(); Image image = (Image)this.Resources["image"]; Read More...
  • Inspired By Flash Math Creativity: WPF Flowers

    I've recently picked up a great book called Flash Math Creativity . I been inspired by some of the techniques it outlines and have played around with similar ideas in WPF. The exercise has been a fruitful one, in that I'm making some pleasing computer art while also learning about the differences between Action Script animation and WPF animation. The first one I played with is flowers, inspired by the work of Glen Rhodes , which is actually featured on the cover of the book. You can see the results here and download the code here . The first flower, which has no animation, is pretty simple. I just create 125 rectangles with a fill using a DrawingBrush I created in Blend. I place each of the petals on the "stage", which in the case is a Grid . I use Grid instead of Canvas so that I get the goodness of the WPF layout engine for free without having to handle any positioning of the rectangles. I then tranform the rotation and scale of each one to create the flower effect. I also swap the ZIndex Read More...

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us