Is there a way to animate the edges of an image in WPF?

We have several icons in our WPF application. We want to make the animation look a lot like a small beacon of light passing along the edges of the animation, simply bypassing it endlessly and following the silhouettes of the icons. We found a way to do this by manually creating a path around the icons and getting a beacon, following this path (which matches the silhouette), but this is too much manual work, because we have many different icons in the shape. We are wondering if there is a way for WPF to do this automatically, so we just need to program it once, and then use the rest of the icons.

Any suggestion is very welcome.

Thanks.

Edit

Something like that .

+4
source share
2 answers

D. Isn't this a surplus for using the wpf animation features for this? Can't you create a bunch of small animations in Photoshop or use something else and just paste them?

Like animated .GIF. the only problem is that: if I remember correctly, WPF has problems with .GIF animations as embedded resources. Therefore, you must load them from disk. Or you can use them as embedded resources, but you should temporarily extract them to disk and load them into the application window.

+1
source

If you use .NET 3.5 SP1 or higher, and you need a solution for the code instead of animated GIFs, my suggestion would be Pixel Shader. You will need to write your own Pixel Shader, which will do the following:

If you have not worked with Pixel Shaders, I would recommend downloading the Shazzam Tool, http://shazzam-tool.com/ . It includes an interactive development environment for creating and testing your shader on simple images, and also includes a decent amount of pixel shaders with source code to help you learn about them.

+1
source

Source: https://habr.com/ru/post/1342567/


All Articles