Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
Hello,

I would like to create a Flash-like animation in C# that takes user input and then draws updates that animation.
I have created a Windows Forms application that takes input from the user and displays the textual data, but I would like to simulate it in an animation as well.
For e.g., if a user wants to see n number of balls move in a certain path, he enters the value for n and the animation is adjusted to play with n balls.
Is there a way to do this? Am I even using the right technology for it?

In case, this question is stupid, please bear with me as I am a beginner.
Posted
Updated 19-Nov-11 9:07am
v2
Comments
Sergey Alexandrovich Kryukov 19-Nov-11 16:58pm    
So, is this really about Forms? Then remove WPF from your tags. Or explain.
--SA

If you want animations that are updated according to a text, you can create a WPF animations and, update them in the event-handler of the TextChanged event of your TextBox.
 
Share this answer
 
v3
Comments
Member 8412210 20-Nov-11 1:13am    
Thank you for the animations link. :)
I think WPF is better designed for animations, but if you really want using Forms, it's quite doable. You can find some basic ideas in my past solution, see how to do image animation[^].

You ball animation is a simple case (and I happened to do something like this). Balls are rendered in Control.OnPaint using an instance of Graphics passes as a parameter to this method, based on current time and the calculated model. The rendering update is triggered by a call to the method Control.Invalidate.

—SA
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 19-Nov-11 17:29pm    
Who is so "clever" to vote like that? :-)
--SA
Member 8412210 20-Nov-11 0:59am    
Thank you Shmuel and SAKryukov,
I've started the application in Windows Forms, but I've researched abt WPF being better for animations as you suggested, however i havent used it before. Thats why i tagged it. So that i may know if its better to code in that and again if what i wanted to do in it is possible.
To my limited knowledge, it seems i would create the animation i want using Blend to generate the XAML required in the WPF. Then send the user input value to that code to create the required no. of balls in tht animation? Is there a better way to get it done than this?
Thank you for the image animation tutorial link. It is a really good & helpful article. I will try and search for a WPF equivalent of it. Any directions to such links are welcome.
Thank you

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