Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I want to make a animation in which a point of light is travelling across a path in WPF.

I have tried finding how to do this; can you please help me regarding this.

I have simple path animation working, but not the point light travelling along it.

Thanks in advance.
Posted
Updated 20-Apr-11 21:44pm
v2
Comments
Sergey Alexandrovich Kryukov 20-Apr-11 13:24pm    
Funny idea (no matter what the purpose is), my 5.
--SA
Dalek Dave 21-Apr-11 3:44am    
Edited for Spelling and Readability.

1 solution

You need to create a semi-transparent object representing darker area and a fuzzy-edged "hole" in the center of it pictured as a highly-transparent area. Call it a "mask" object. It should be at least two times the size of your biggest canvas in both directions. Place this object on the canvas in a Z-order to be on top of all other objects. Animate the position of this mask object. Unused part of the mask object will be clipped off by the bound of your canvas, and the "hole" area will be perceived as a cast of a flashlight.

Play with the color and balance transparencies of the mask object to achieve realistic effect.

[EDIT]

For a simple mask object you can use just a bitmap (using, say, PNG with transparency). A vector mask object would be more convenient (scaling, etc.). You can draw it with Inkscape vector editor: http://en.wikipedia.org/wiki/Inkspace[^], highly recommended). The vector format is SVG (http://en.wikipedia.org/wiki/Scalable_Vector_Graphics[^]), use conversion to XAML using Inkscape (do not use features not supported by XAML such as fuzziness; a fuzzy transparency is different: it can be done through gradient in alpha channel).

—SA
 
Share this answer
 
v4
Comments
Nabhaite 21-Apr-11 1:53am    
Thanks man. But I would really appreciate if you could please help me with code. what would be the code for doing above mentioned stuff. Thanks again.
Sergey Alexandrovich Kryukov 21-Apr-11 2:45am    
Before we discuss it, please tell me: did you vote 3 just because I did not post any code? It could be some hours of work...
--SA
Nabhaite 21-Apr-11 3:00am    
No. I just accidently put it. I am sorry for that and I even gave 5 the very next moment. I didn't mean to hurt you.
Nabhaite 21-Apr-11 2:58am    
No. I just accidently put it. I am sorry for that and I even gave 5 the very next moment.
I didn't mean to hurt you.
Nabhaite 21-Apr-11 2:59am    
I am new to codeproject, this is my first quesstion and now I should have replied instead of adding next comment...oops.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900