![]() |
|
[.NET] Animation Library - Easily animate your application - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Animation Library - Easily animate your application (/showthread.php?tid=4484630) |
Animation Library - Easily animate your application - BlackCap - Oct 10, 2014 Source: http://pastebin.com/WBqqJJqd Usage First of all you need a method that takes at least one double between 0 and 1, and does something with it; move a control for instance: PHP Code you could also use lambda PHP Code You then have to make a animation PHP Code
To run your animation you simply call: PHP Code The animation class works pretty much like a timer. It have both a Start and a Stop method, and a Interval property too. The interval is how often it should call whatever method you gave it, and it defaults to 40 times a second. It also have a Reset method, which stops the animation and resets everything. You can also add another animation to the first with the Add method. Calling Add with a method of your choise actually returns a instance of the "Builder" class, which is a class that let you partially apply parameters to your method: PHP Code So if you wanted to move a specific control a lot you could partially apply a control to the builder, and then apply a shitton of transitions to it afterwards: PHP Code The animation class is actually a list of "Motions" which is a class which have a single transition, a single method (e.g. our MoveCtrl function), and also have StartAt, Length and Loop properties. StartAt and Length are integers representing where to start and the length of the motion in milliseconds, and Loop is a boolean representing wether or not to loop the motion. If you only need a single motion there is a Transistor class, which is basically a single Transition and a timer in one package. A Transition is defined like this: PHP Code In the Transitions class you'll find the following transitions:
The reason that the last two transitions ends with "1" is that the Transitions class also have correspondending Jumpback and Elastic functions aswell as a Pow function. These three functions take a double indicating the "Strength" of the transition, and returns a Transition. You also have a few extension methods for transitions:
Usage: PHP Code And a few handy ones for constructing transitions:
I will support this thing for at least a couple of months, and I'd be sweet if you guys cared to hand me your two cents as well as a bucket or two of bug reports. * - Corios - Oct 10, 2014 Just curious, why would you want to use this over say WPF? Not attacking you, just curious as to why use this when there are other extremely developed options * - BlackCap - Oct 10, 2014 (Oct 10, 2014 08:42 PM)Corios Wrote: Just curious, why would you want to use this over say WPF? Not attacking you, just curious as to why use this when there are other extremely developed options Partly for backwards compability, but mostly because it's a lot more fun to make stuff youself. Also, this isn't windows forms exclusive; it would work just as good with WPF. * - Corios - Oct 10, 2014 (Oct 10, 2014 08:46 PM)BlackCap Wrote: Partly for backwards compability, but mostly because it's a lot more fun to make stuff youself. Also, this isn't windows forms exclusive; it would work just as good with WPF. Fair enough :P I'll check it out once I get back, looks pretty good! * - SaketSaket - Oct 11, 2014 Would love to see how it actually works.... Wonderful work... ;) * - Only3 - Oct 11, 2014 back to net section looks good if i remember u have another thread about it * - SIM-1456245 - Oct 11, 2014 Very impressive man, I was really looking forward to learn about animations in VB.Net, but hmm, this moves around controls only, what about GDI animation class ? |